### Question:
Game implements Reflectable { public Map<String, Object> serialize() { Map<String, Object> theResult = new HashMap<>(); theResult.put(NAME_PROPERTY, name.get()); theResult.put("defaultscene", defaultScene.get()); theResult.put("enablewebgl", Boolean.toString(enableWebGL.get())); theResult.put("customProperties", customProperties.get().serialize()); theResult.put("enableDebug", Boolean.toString(enableDebug.get())); theResult.put("enableNetworking", Boolean.toString(enableNetworking.get())); theResult.put("firebaseURL", fireBaseURL.get()); theResult.put("scenes", new ArrayList<>(scenes)); return theResult; } Game(); @ReflectiveField Property<String> nameProperty(); @ReflectiveField Property<String> defaultSceneProperty(); @ReflectiveField Property<Boolean> enableWebGLProperty(); @ReflectiveField Property<Boolean> enableDebugProperty(); @ReflectiveField Property<Boolean> enableNetworkingProperty(); @ReflectiveField Property<String> fireBaseURLProperty(); void removeScene(String aSceneName); String[] getKnownScenes(); @ReflectiveField Property<CustomProperties> customPropertiesProperty(); @Override GameClassInformation getClassInformation(); Map<String, Object> serialize(); static Game deserialize(Map<String, Object> aSerializedData); static final String NAME_PROPERTY; static final String DEFAULT_SCENE_PROPERTY; static final String ENABLE_WEB_GL_PROPERTY; static final String CUSTOM_PROPERTIES_PROPERTY; static final String ENABLE_DEBUG_PROPERTY; static final String ENABLE_NETWORKING_PROPERTY; static final String FIREBASE_URL; }### Answer:
@Test public void testSerialize() throws Exception { Game theGame = new Game(); theGame.nameProperty().set("Testgame"); theGame.defaultSceneProperty().set("scene1"); theGame.customPropertiesProperty().get().set("key", "value"); Map<String, Object> theData = theGame.serialize(); assertEquals(8, theData.size()); assertEquals("Testgame", theData.get(Game.NAME_PROPERTY)); assertEquals("scene1", theData.get("defaultscene")); assertEquals("true", theData.get("enablewebgl")); assertEquals("false", theData.get("enableDebug")); assertEquals("false", theData.get("enableNetworking")); assertEquals(0, ((List<String>)theData.get("scenes")).size()); assertEquals("https: Map<String, String> theProps = (Map<String, String>) theData.get("customProperties"); assertEquals(1, theProps.size(), 0); }