Fix unit test MessageTest after refactoring

This commit is contained in:
Sebastian Kaspari 2011-03-14 22:32:28 +01:00
parent 95f3c4b255
commit 488924546f
3 changed files with 24 additions and 11 deletions

View File

@ -78,7 +78,7 @@ public class Message
private final String text;
private final String sender;
private SpannableString canvas;
private final long timestamp;
private long timestamp;
private int color = NO_COLOR;
private int type = NO_ICON;
@ -177,6 +177,17 @@ public class Message
{
this.color = color;
}
/**
* Set the timestamp of the message
*
* @param timestamp
*/
public void setTimestamp(long timestamp)
{
this.timestamp = timestamp;
}
/**
* Associate a color with a sender name
*
@ -296,7 +307,7 @@ public class Message
* @param use24hFormat
* @return
*/
private String renderTimeStamp(boolean use24hFormat)
public String renderTimeStamp(boolean use24hFormat)
{
Date date = new Date(timestamp);

View File

@ -58,14 +58,16 @@ public class MessageTest extends TestCase
public void testTimestamp()
{
String timestamp1 = Message.generateTimestamp(1270505773862l, false);
assertEquals("[00:16] ", timestamp1);
String timestamp2 = Message.generateTimestamp(1270505773862l, true);
assertEquals("[00:16] ", timestamp2);
Message message = new Message("");
String timestamp3 = Message.generateTimestamp(1270908275000l, false);
assertEquals("[04:04] ", timestamp3);
String timestamp4 = Message.generateTimestamp(1270908275000l, true);
assertEquals("[16:04] ", timestamp4);
message.setTimestamp(1270505773862l);
assertEquals("[00:16] ", message.renderTimeStamp(false));
assertEquals("[00:16] ", message.renderTimeStamp(true));
message.setTimestamp(1270908275000l);
assertEquals("[04:04] ", message.renderTimeStamp(false));
assertEquals("[16:04] ", message.renderTimeStamp(true));
}
}

View File

@ -95,7 +95,7 @@ public class ConnectionScenarios extends ActivityInstrumentationTestCase2
solo.enterText(0, "/j #yaaic-test");
solo.sendKey(Solo.ENTER);
solo.sleep(1000);
solo.sleep(1500);
// Assert channel joined
assertTrue(solo.searchText("#yaaic-test"));