MCPcopy Create free account
hub / github.com/Neop/mudmap2 / testIsPlaceNameUnique

Method testIsPlaceNameUnique

src/test/java/mudmap2/backend/LayerTest.java:829–861  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

827 *
828 */
829 @Test
830 public void testIsPlaceNameUnique(){
831 System.out.println("isPlaceNameUnique");
832
833 Layer instance = world.getNewLayer();
834
835 // place not inserted yet: name is unique
836 assertTrue(instance.isPlaceNameUnique("PlaceName"));
837
838 try {
839 Place place1 = new Place("PlaceName", 0, 0, instance);
840 instance.put(place1);
841 // place inserted, name is unique
842 assertTrue(instance.isPlaceNameUnique("PlaceName"));
843
844 Place place2 = new Place("PlaceName", 1, 0, instance);
845 instance.put(place2);
846 // place name inserted twice, name is unique
847 assertFalse(instance.isPlaceNameUnique("PlaceName"));
848
849 Place place3 = new Place("PlaceName", 2, 0, instance);
850 instance.put(place3);
851 // place name inserted thrice, name is unique
852 assertFalse(instance.isPlaceNameUnique("PlaceName"));
853
854 instance.remove(place3);
855 instance.remove(place2);
856 assertTrue(instance.isPlaceNameUnique("PlaceName"));
857 } catch (Layer.PlaceNotInsertedException | RuntimeException ex) {
858 Logger.getLogger(LayerTest.class.getName()).log(Level.SEVERE, null, ex);
859 }
860
861 }
862
863}

Callers

nothing calls this directly

Calls 5

isPlaceNameUniqueMethod · 0.95
putMethod · 0.95
removeMethod · 0.95
getNewLayerMethod · 0.80
getNameMethod · 0.45

Tested by

no test coverage detected