### Question:
GdxJsonExporter implements Exporter { @Override public void save(Level level, List<GameObject> objects, Properties properties, FileHandle fh) { System.out.println("GdxJsonExporter: Saving level to " + fh.toString()); fh.writeString(getJsonString(level, objects, properties), false); }  @Override String getFileExtension(); @Override String getFormatName(); @Override void save(Level level, List<GameObject> objects, Properties properties, FileHandle fh);  }### Answer:
@Test public void testExporting() { Level level = new Level(); final TileLayer layer = level.createLayer("Test"); layer.draw(imageTileset, 0, 0, 0, 16); layer.draw(imageTileset, 16, 0, 0, 16); layer.draw(paletteTileset, 0, 16, 0, 8); layer.draw(paletteTileset, 8, 16, 0, 8); List<GameObject> objectList = new ArrayList<>(); GameObject obj1 = new GameObject(); obj1.setName("Test1"); obj1.setPosition(1f, 2f, 3f); obj1.setSize(5f, 6f, 7f); obj1.setVisible(true); obj1.setColor(new Color(0.4f, 0.6f, 0.8f, 0.1f)); obj1.setProperty("TestStr", "Foobar"); obj1.setProperty("TestInt", 42); obj1.setProperty("TestBoolTrue", true); obj1.setProperty("TestBoolFalse", false); obj1.setProperty("TestDouble", 3.14); objectList.add(obj1); Properties properties = new Properties(); exporter.save(level, objectList, properties, fh); verify(fh).writeString(captor.capture(), eq(false)); String jsonString = captor.getValue(); System.out.println(jsonString); JsonValue val = new JsonReader().parse(jsonString); assertTrue(val.has("tilesets")); JsonValue tilesets = val.get("tilesets"); assertEquals(2, tilesets.size); JsonValue imageTilesetPart = tilesets.get(0); assertEquals("normal", imageTilesetPart.getString("type")); assertEquals(2, imageTilesetPart.get("tiles").size); JsonValue paletteTilesetPart = tilesets.get(1); assertEquals("palette", paletteTilesetPart.getString("type")); assertEquals(3, paletteTilesetPart.get("tiles").size); assertTrue(val.has("layers")); JsonValue layers = val.get("layers"); assertEquals(1, layers.size); JsonValue layerJson = layers.get(0); assertTrue(layerJson.has("parts")); assertEquals(2, layerJson.get("parts").size); assertEquals(0, layerJson.get("parts").get(0).getInt("tileset")); assertEquals(1, layerJson.get("parts").get(1).getInt("tileset")); assertTrue(val.has("objects")); JsonValue objects = val.get("objects"); assertEquals(1, objects.size); JsonValue o = objects.get(0); assertEquals("Test1", o.getString("name")); float[] location = o.get("location").asFloatArray(); assertEquals(1f, location[0], 0.001f); assertEquals(2f, location[1], 0.001f); assertEquals(3f, location[2], 0.001f); float[] size = o.get("size").asFloatArray(); assertEquals(5f, size[0], 0.001f); assertEquals(6f, size[1], 0.001f); assertEquals(7f, size[2], 0.001f); float[] color = o.get("color").asFloatArray(); assertEquals(0.4f, color[0], 0.0001f); assertEquals(0.6f, color[1], 0.0001f); assertEquals(0.8f, color[2], 0.0001f); assertEquals(0.1f, color[3], 0.0001f); assertTrue(o.getBoolean("visible")); }