コード例 #1
0
 public String renderResult(Result matchResult) {
   String result = "";
   if (matchResult != null) {
     result =
         Integer.toString(matchResult.getHomeGoals())
             + ":"
             + Integer.toString(matchResult.getAwayGoals());
   }
   return result;
 }
コード例 #2
0
  @Before
  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    when(resultMock.isHomeWin()).thenReturn(false);
    when(resultMock.isDraw()).thenReturn(false);
    when(resultMock.isAwayWin()).thenReturn(false);

    colorPicker = new ColorPicker();
  }
コード例 #3
0
 @Test
 public void picksCorrectAwayWinColor() throws Exception {
   // Arrange
   when(resultMock.isAwayWin()).thenReturn(true);
   // Act
   Color pickedColor = colorPicker.pickResultColor(resultMock);
   // Assert
   assertThat(pickedColor, is(Colors.AWAY_WIN_BG_COLOR));
 }
コード例 #4
0
 @Test
 public void picksCorrectDrawColor() throws Exception {
   // Arrange
   when(resultMock.isDraw()).thenReturn(true);
   // Act
   Color pickedColor = colorPicker.pickResultColor(resultMock);
   // Assert
   assertThat(pickedColor, is(Colors.DRAW_BG_COLOR));
 }