### Question:
LocationController { public List<Location> getAllLocations() throws LocationLoadException { try { return locationService.getAllLocations(); } catch (IOException e) { throw new LocationLoadException(e); } } LocationController(LocationService locationService); List<Location> downloadLocationFromServerByName(String name); Location downloadLocationFromServerByUuid(String uuid); List<Location> downloadLocationsFromServerByUuid(String[] uuids); List<Location> getAllLocations(); void saveLocation(Location location); void saveLocations(List<Location> locations); Location getLocationByUuid(String uuid); List<LocationAttributeType> getLocationAttributesByName(String name); LocationAttributeType getLocationAttributeTypeByUuid(String uuid); Location getLocationByAttributeTypeAndValue(LocationAttributeType attributeType,String attribute); Location getLocationByName(String name); Location getLocationById(int id); void deleteLocation(Location location); void deleteLocations(List<Location> locations); List<Location> getRelatedLocations(List<FormTemplate> formTemplates); void newLocations(List<Location> locations); List<Location> newLocations(); void deleteAllLocations();  }### Answer:
@Test public void getAllLocations_shouldReturnAllAvailableLocations() throws IOException, LocationController.LocationLoadException { List<Location> locations = new ArrayList<>(); when(locationService.getAllLocations()).thenReturn(locations); assertThat(locationController.getAllLocations(), is(locations)); }
@Test(expected = LocationController.LocationLoadException.class) public void getAllLocations_shouldThrowLoLocationFetchExceptionIfExceptionThrownByLocationService() throws IOException, LocationController.LocationLoadException { doThrow(new IOException()).when(locationService).getAllLocations(); locationController.getAllLocations(); }