/** * @see LocationService#getAllLocations(null) */ @Test public void getAllLocations_shouldPushRetiredLocationsToTheEndOfTheListWhenIncludeRetiredIsTrue() { LocationService ls = Context.getLocationService(); //retire the first location ls.retireLocation(ls.getAllLocations().get(0), "Just Testing"); // Get all locations. List<Location> locations = ls.getAllLocations(); //The 2 retired locations should be always be at the end Assert.assertTrue("Retired locations should be at the end of the list", locations.get(locations.size() - 1) .getRetired()); Assert.assertTrue("Retired locations should be at the end of the list", locations.get(locations.size() - 2) .getRetired()); }
/** * @see LocationService#retireLocation(Location location, String reason) */ @Test public void retireLocation_shouldNotRetireIndependentField() { LocationService locationService = Context.getLocationService(); Location location = new Location(1); location.setName("location to retire"); LocationTag tag = new LocationTag(1); location.addTag(tag); locationService.retireLocation(location, "test retire reason"); Assert.assertFalse(tag.getRetired()); }
Location retiredLoc = ls.retireLocation(location, "Just Testing");