### Question:
VaultSettingsJsonAdapter { public void write(JsonWriter out, VaultSettings value) throws IOException { out.beginObject(); out.name("id").value(value.getId()); out.name("path").value(value.path().get().toString()); out.name("displayName").value(value.displayName().get()); out.name("winDriveLetter").value(value.winDriveLetter().get()); out.name("unlockAfterStartup").value(value.unlockAfterStartup().get()); out.name("revealAfterMount").value(value.revealAfterMount().get()); out.name("useCustomMountPath").value(value.useCustomMountPath().get()); out.name("customMountPath").value(value.customMountPath().get()); out.name("usesReadOnlyMode").value(value.usesReadOnlyMode().get()); out.name("mountFlags").value(value.mountFlags().get()); out.name("filenameLengthLimit").value(value.filenameLengthLimit().get()); out.name("actionAfterUnlock").value(value.actionAfterUnlock().get().name()); out.endObject(); }  void write(JsonWriter out, VaultSettings value); VaultSettings read(JsonReader in);  }### Answer:
@Test public void testSerialize() throws IOException { VaultSettings vaultSettings = new VaultSettings("test"); vaultSettings.path().set(Paths.get("/foo/bar")); vaultSettings.displayName().set("mountyMcMountFace"); vaultSettings.mountFlags().set("--foo --bar"); StringWriter buf = new StringWriter(); JsonWriter jsonWriter = new JsonWriter(buf); adapter.write(jsonWriter, vaultSettings); String result = buf.toString(); MatcherAssert.assertThat(result, CoreMatchers.containsString("\"id\":\"test\"")); if(System.getProperty("os.name").contains("Windows")){ MatcherAssert.assertThat(result, CoreMatchers.containsString("\"path\":\"\\\\foo\\\\bar\"")); } else { MatcherAssert.assertThat(result, CoreMatchers.containsString("\"path\":\"/foo/bar\"")); } MatcherAssert.assertThat(result, CoreMatchers.containsString("\"displayName\":\"mountyMcMountFace\"")); MatcherAssert.assertThat(result, CoreMatchers.containsString("\"mountFlags\":\"--foo --bar\"")); }