@Test public void testAddMessage() { MessageData expected = new MessageData( "Ray", "Hey, can I see at Coffeshop", "Gothic", "20", false, false, false, "#000000", false); cd1.addMessage(expected); assertTrue(cd1.getText().contains(expected)); }
@Test public void testGetText() { // This test should be modified MessageData expected = new MessageData( "Rakan", "Hey how are you doing?", "TimesNewRoman", "13", false, false, false, "#000000", false); cd1.addMessage(expected); assertSame(expected, cd1.getText().get(0)); }
@Test public void testDisplayMessages() { MessageData e1 = new MessageData( "Godfather", "I'll give you an offer that you can't refuse", "Calbarie", "18", false, false, false, "#000000", true); MessageData e2 = new MessageData( "Fannuci", "Meet me at the restuarant", "TimesNewRoman", "16", false, false, false, "#000000", true); cd1.addMessage(e1); cd1.addMessage(e2); // Assert it contains all messagedata from e1 attributes assertTrue(cd1.displayMessages().contains(e1.getFont())); assertTrue(cd1.displayMessages().contains(e1.getFromUser())); assertTrue(cd1.displayMessages().contains(e1.getMessage())); assertTrue(cd1.displayMessages().contains(e1.getSize())); // Assert it contains all messageData from e2 attributes assertTrue(cd1.displayMessages().contains(e2.getFont())); assertTrue(cd1.displayMessages().contains(e2.getFromUser())); assertTrue(cd1.displayMessages().contains(e2.getMessage())); assertTrue(cd1.displayMessages().contains(e2.getSize())); // // from here I got expected value // // System.out.println(cd1.displayMessages()); }
@Test public void testGetMessageCount() { // Modify this test int expected = 0; assertSame(expected, cd2.getMessageCount()); MessageData e = new MessageData( "DeNiro", "Did you saw my movie?", "Italic", "15", false, false, false, "#000000", false); cd2.addMessage(e); expected++; assertTrue(expected == cd2.getMessageCount()); expected++; assertFalse(expected == cd2.getMessageCount()); }