RawTimeScoringInteractor { public void score(ScoredRun scoredRun) { BigDecimal eventConePenaltySeconds = scoredRun.getRun().getEvent().getConePenaltySeconds(); BigDecimal runCones = BigDecimal.valueOf(scoredRun.getRun().getCones()); BigDecimal conePenaltySeconds = eventConePenaltySeconds.multiply(runCones); BigDecimal rawTimeScored = scoredRun.getRun().getRawTime().add(conePenaltySeconds); scoredRun.setRawTimeScored(rawTimeScored); } @Inject  RawTimeScoringInteractor(); void score(ScoredRun scoredRun);  }
@Test public void itShouldSetRawTimeScoredForCleanRun() { when(run.getCones()).thenReturn(0); interactor.score(scoredRun); verify(scoredRun).setRawTimeScored(eq(TestConstants.RUN_RAW_TIME)); }
@Test public void itShouldSetRawTimeScoredForConedRun() { BigDecimal rawTime = BigDecimal.valueOf(100.000D); when(run.getRawTime()).thenReturn(rawTime); when(run.getCones()).thenReturn(3); BigDecimal expected = BigDecimal.valueOf(106.000D); interactor.score(scoredRun); verify(scoredRun).setRawTimeScored(eq(expected)); }