@Test public void throwRNFExceptionWhenRetrieveMultipleVehiclesWithUnknownVehiclesInGarage() throws Exception { when(vehicleRepository.findAllByGarageId("gId")).thenReturn(null); expectedException.expect(Is.isA(ResourcesNotFoundException.class)); expectedException.expectMessage("Vehicle not found"); defaultVehicleService.findAllVehicles("gId"); }
@Test public void retrieveMultipleVehiclesFromGarage() throws Exception { List<VehicleResponse> vehicleResponseList = new ArrayList(); when(vehicleRepository.findAllByGarageId("gId")).thenReturn(vehicleResponseList); defaultVehicleService.findAllVehicles("gId"); verify(vehicleRepository, times(1)).findAllByGarageId("gId"); verifyNoMoreInteractions(vehicleRepository); }