@Test public void testDeleteCarClassCompetitionResult() throws Exception { CarClassCompetitionResult carClassCompetitionResult = new CarClassCompetitionResult(); carClassCompetitionResult.setComment("this is a test comment"); carClassCompetitionResultServiceImpl.deleteCarClassCompetitionResult(carClassCompetitionResult); verify(carClassCompetitionResultDAO, times(1)) .deleteCarClassCompetitionResult(carClassCompetitionResult); }
@Test public void testGetCarClassCompetitionResultsByCarClassCompetition() throws Exception { List<CarClassCompetitionResult> carClassCompetitionResults = new ArrayList<CarClassCompetitionResult>(); CarClassCompetitionResult result1 = new CarClassCompetitionResult(); CarClassCompetitionResult result2 = new CarClassCompetitionResult(); CarClassCompetition carClassCompetition = new CarClassCompetition(); carClassCompetition.setCircleCount(5); result1.setComment("test1 result"); result1.setComment("test2 result"); carClassCompetitionResults.add(result1); carClassCompetitionResults.add(result2); when(carClassCompetitionResultDAO.getCarClassCompetitionResultsByCarClassCompetition( carClassCompetition)) .thenReturn(carClassCompetitionResults); assertEquals( "Expected 2 results", 2, (carClassCompetitionResultServiceImpl .getCarClassCompetitionResultsByCarClassCompetition(carClassCompetition) .size())); }