@Test @Ignore("failing test fix!") public void givenMagazine_shouldSerialiseToJson() throws MalformedURLException { String expectedJson = "{\"author\":{\"firstName\":\"Alex\",\"lastName\":\"Theedom\"},\"binding\":\"SOFT_BACK\",\"id\":\"ABCD-1234\",\"inPrint\":true,\"languages\":[\"French\",\"English\",\"Spanish\",null],\"pages\":300,\"price\":45.0,\"published\":\"2018-01-01\",\"title\":\"Fun with Java\",\"website\":\"https: ComprehensiveExample comprehensiveExample = new ComprehensiveExample(); String actualJson = comprehensiveExample.serialiseMagazine(); assertThat(actualJson).isEqualTo(expectedJson); }
public String serialiseMagazine() throws MalformedURLException { Magazine magazine = new Magazine(); magazine.setId("ABCD-1234"); magazine.setTitle("Fun with Java"); magazine.setAuthor(new Author("Alex", "Theedom")); magazine.setPrice(45.00f); magazine.setPages(300); magazine.setInPrint(true); magazine.setBinding(Binding.SOFT_BACK); magazine.setLanguages(Arrays.asList("French", "English", "Spanish", null)); magazine.setWebsite(new URL("https: magazine.setInternalAuditCode("IN-675X-NF09"); magazine.setPublished(LocalDate.parse("01/01/2018", DateTimeFormatter.ofPattern("MM/dd/yyyy"))); magazine.setAlternativeTitle(null); return JsonbBuilder.create().toJson(magazine); }
ComprehensiveExample { public String serialiseMagazine() throws MalformedURLException { Magazine magazine = new Magazine(); magazine.setId("ABCD-1234"); magazine.setTitle("Fun with Java"); magazine.setAuthor(new Author("Alex", "Theedom")); magazine.setPrice(45.00f); magazine.setPages(300); magazine.setInPrint(true); magazine.setBinding(Binding.SOFT_BACK); magazine.setLanguages(Arrays.asList("French", "English", "Spanish", null)); magazine.setWebsite(new URL("https: magazine.setInternalAuditCode("IN-675X-NF09"); magazine.setPublished(LocalDate.parse("01/01/2018", DateTimeFormatter.ofPattern("MM/dd/yyyy"))); magazine.setAlternativeTitle(null); return JsonbBuilder.create().toJson(magazine); } }
ComprehensiveExample { public String serialiseMagazine() throws MalformedURLException { Magazine magazine = new Magazine(); magazine.setId("ABCD-1234"); magazine.setTitle("Fun with Java"); magazine.setAuthor(new Author("Alex", "Theedom")); magazine.setPrice(45.00f); magazine.setPages(300); magazine.setInPrint(true); magazine.setBinding(Binding.SOFT_BACK); magazine.setLanguages(Arrays.asList("French", "English", "Spanish", null)); magazine.setWebsite(new URL("https: magazine.setInternalAuditCode("IN-675X-NF09"); magazine.setPublished(LocalDate.parse("01/01/2018", DateTimeFormatter.ofPattern("MM/dd/yyyy"))); magazine.setAlternativeTitle(null); return JsonbBuilder.create().toJson(magazine); }  }
ComprehensiveExample { public String serialiseMagazine() throws MalformedURLException { Magazine magazine = new Magazine(); magazine.setId("ABCD-1234"); magazine.setTitle("Fun with Java"); magazine.setAuthor(new Author("Alex", "Theedom")); magazine.setPrice(45.00f); magazine.setPages(300); magazine.setInPrint(true); magazine.setBinding(Binding.SOFT_BACK); magazine.setLanguages(Arrays.asList("French", "English", "Spanish", null)); magazine.setWebsite(new URL("https: magazine.setInternalAuditCode("IN-675X-NF09"); magazine.setPublished(LocalDate.parse("01/01/2018", DateTimeFormatter.ofPattern("MM/dd/yyyy"))); magazine.setAlternativeTitle(null); return JsonbBuilder.create().toJson(magazine); }  String serialiseMagazine(); Magazine deserialiseMagazine(); }
ComprehensiveExample { public String serialiseMagazine() throws MalformedURLException { Magazine magazine = new Magazine(); magazine.setId("ABCD-1234"); magazine.setTitle("Fun with Java"); magazine.setAuthor(new Author("Alex", "Theedom")); magazine.setPrice(45.00f); magazine.setPages(300); magazine.setInPrint(true); magazine.setBinding(Binding.SOFT_BACK); magazine.setLanguages(Arrays.asList("French", "English", "Spanish", null)); magazine.setWebsite(new URL("https: magazine.setInternalAuditCode("IN-675X-NF09"); magazine.setPublished(LocalDate.parse("01/01/2018", DateTimeFormatter.ofPattern("MM/dd/yyyy"))); magazine.setAlternativeTitle(null); return JsonbBuilder.create().toJson(magazine); }  String serialiseMagazine(); Magazine deserialiseMagazine();  }