### Question:
WorldLoader { @Nullable public static Location worldlessBlockLocationFromConfig(@NotNull ConfigurationSection conf) { try { int x = Integer.parseInt(conf.getString(X)); int y = Integer.parseInt(conf.getString(Y)); int z = Integer.parseInt(conf.getString(Z)); return new Location(null, x, y, z); } catch (NumberFormatException ex) { return null; } }  @NotNull static ConfigurationSection locationToConfig(@NotNull Location location, boolean useUUID); @Nullable static Location locationFromConfig(@NotNull ConfigurationSection conf, boolean useUUID); @NotNull static ConfigurationSection blockLocationToConfig(@NotNull Location location, boolean useUUID); @Nullable static Location blockLocationFromConfig(@NotNull ConfigurationSection conf, boolean useUUID); @Nullable static Location worldlessBlockLocationFromConfig(@NotNull ConfigurationSection conf); @Nullable static World worldFromConfig(@NotNull ConfigurationSection conf, boolean useUUID); static final String WORLD_UID; static final String WORLD_NAME; static final String X; static final String Y; static final String Z; static final String YAW; static final String PITCH; }### Answer:
@Test public void worldlessBlockLocFromConfEmpty() { Location loc = WorldLoader.worldlessBlockLocationFromConfig(new YamlConfiguration()); Assert.assertNull(loc); }
@Test public void worldlessBlockLocFromConfValid() { YamlConfiguration conf = new YamlConfiguration(); conf.set(WorldLoader.X, 4); conf.set(WorldLoader.Y, 0); conf.set(WorldLoader.Z, -4); Location loc = WorldLoader.worldlessBlockLocationFromConfig(conf); Assert.assertNotNull(loc); }
@Test public void worldlessBlockLocFromConfNotAllKeys() { YamlConfiguration conf = new YamlConfiguration(); conf.set(WorldLoader.X, 4); conf.set(WorldLoader.Z, -4); Location loc = WorldLoader.worldlessBlockLocationFromConfig(conf); Assert.assertNull(loc); }
@Test public void worldlessBlockLocFromConfWrongType() { YamlConfiguration conf = new YamlConfiguration(); conf.set(WorldLoader.X, "aaaaaa"); conf.set(WorldLoader.Y, 0); conf.set(WorldLoader.Z, -4); Location loc = WorldLoader.worldlessBlockLocationFromConfig(conf); Assert.assertNull(loc); }