MoreInfoImpl extends Composite implements MoreInfo { @Override public void update(@Nullable Runner runner) { if (runner == null) { started.setText(TIMER_STUB); finished.setText(TIMER_STUB); timeout.setText(TIMER_STUB); activeTime.setText(TIMER_STUB); ram.setText(0 + "MB"); } else { started.setText(runner.getCreationTime()); finished.setText(runner.getStopTime()); timeout.setText(runner.getTimeout()); activeTime.setText(runner.getActiveTime()); ram.setText(runner.getRAM() + "MB"); } } @Inject  MoreInfoImpl(RunnerResources resources, RunnerLocalizationConstant locale); @Override void update(@Nullable Runner runner);  }
@Test public void contentShouldBeUpdatedWhenRunnerIsExisted() throws Exception { when(runner.getCreationTime()).thenReturn(SOME_TEXT); when(runner.getStopTime()).thenReturn(SOME_TEXT); when(runner.getTimeout()).thenReturn(SOME_TEXT); when(runner.getActiveTime()).thenReturn(SOME_TEXT); when(runner.getRAM()).thenReturn(128); widget.update(runner); verify(widget.started).setText(SOME_TEXT); verify(widget.finished).setText(SOME_TEXT); verify(widget.timeout).setText(SOME_TEXT); verify(widget.activeTime).setText(SOME_TEXT); verify(widget.ram).setText("128MB"); }
@Test public void contentShouldBeUpdatedWhenRunnerIsNull() throws Exception { widget.update(null); verify(widget.started).setText(TIMER_STUB); verify(widget.finished).setText(TIMER_STUB); verify(widget.timeout).setText(TIMER_STUB); verify(widget.activeTime).setText(TIMER_STUB); verify(widget.ram).setText("0MB"); }