@Test (expected = FileNotFoundException.class) public void testLoadRegionWithNotExistentMap () throws IOException { RegionInfo regionInfo = new RegionInfo(); regionInfo.load(new File("../data/junit/regions/region1.json")); }
public void load (File file) throws IOException { Objects.requireNonNull(file); if (!file.exists()) { throw new FileNotFoundException("region info file (by default region.json) doesn't exists: " + file.getAbsolutePath()); } String content = FileUtils.readFile(file.getAbsolutePath(), StandardCharsets.UTF_8); JsonObject json = new JsonObject(content); this.load(json, file.getParentFile().getAbsolutePath() + "/"); }
RegionInfo { public void load (File file) throws IOException { Objects.requireNonNull(file); if (!file.exists()) { throw new FileNotFoundException("region info file (by default region.json) doesn't exists: " + file.getAbsolutePath()); } String content = FileUtils.readFile(file.getAbsolutePath(), StandardCharsets.UTF_8); JsonObject json = new JsonObject(content); this.load(json, file.getParentFile().getAbsolutePath() + "/"); } }
RegionInfo { public void load (File file) throws IOException { Objects.requireNonNull(file); if (!file.exists()) { throw new FileNotFoundException("region info file (by default region.json) doesn't exists: " + file.getAbsolutePath()); } String content = FileUtils.readFile(file.getAbsolutePath(), StandardCharsets.UTF_8); JsonObject json = new JsonObject(content); this.load(json, file.getParentFile().getAbsolutePath() + "/"); } RegionInfo(); }
RegionInfo { public void load (File file) throws IOException { Objects.requireNonNull(file); if (!file.exists()) { throw new FileNotFoundException("region info file (by default region.json) doesn't exists: " + file.getAbsolutePath()); } String content = FileUtils.readFile(file.getAbsolutePath(), StandardCharsets.UTF_8); JsonObject json = new JsonObject(content); this.load(json, file.getParentFile().getAbsolutePath() + "/"); } RegionInfo(); void load(File file); String getTitle(); int getTileWidth(); int getTileHeight(); List<RegionMap> listMaps(); String getRegionDir(); boolean isDrawGroundAlways(); }
RegionInfo { public void load (File file) throws IOException { Objects.requireNonNull(file); if (!file.exists()) { throw new FileNotFoundException("region info file (by default region.json) doesn't exists: " + file.getAbsolutePath()); } String content = FileUtils.readFile(file.getAbsolutePath(), StandardCharsets.UTF_8); JsonObject json = new JsonObject(content); this.load(json, file.getParentFile().getAbsolutePath() + "/"); } RegionInfo(); void load(File file); String getTitle(); int getTileWidth(); int getTileHeight(); List<RegionMap> listMaps(); String getRegionDir(); boolean isDrawGroundAlways();  }