@Test public void swappedValuesTest() { String expected = "{\"id\": \"id\", \"created\": null, \"audubonItems\": [{\"creator\": null, \"creatorUri\": \"Jerome Fischer\", " + "\"providerLiteral\": null, \"provider\": null, \"metadataCreatorLiteral\": null, \"metadataCreator\": null," + " \"metadataProviderLiteral\": null, \"metadataProvider\": null, \"rights\": \"http: + "\"rightsUri\": \"http: + "\"webStatement\": null, \"licenseLogoUrl\": null, \"credit\": null, \"attributionLogoUrl\": null, \"attributionLinkUrl\": null," + " \"fundingAttribution\": null, \"source\": null, \"sourceUri\": null, \"description\": \"27 s\", \"caption\": null, \"language\": null, " + "\"languageUri\": null, \"physicalSetting\": null, \"cvTerm\": null, \"subjectCategoryVocabulary\": null, \"tag\": null, " + "\"locationShown\": null, \"worldRegion\": null, \"countryCode\": null, \"countryName\": null, \"provinceState\": null, " + "\"city\": null, \"sublocation\": null, \"identifier\": \"https: + "\"type\": \"Sound\", \"typeUri\": null, \"subtypeLiteral\": null, \"subtype\": null, \"title\": null, \"modified\": null, " + "\"metadataDate\": null, \"metadataLanguageLiteral\": null, \"metadataLanguage\": null, \"providerManagedId\": null, " + "\"rating\": null, \"commenterLiteral\": null, \"commenter\": null, \"comments\": null, \"reviewerLiteral\": null," + " \"reviewer\": null, \"reviewerComments\": null, \"available\": null, \"hasServiceAccessPoint\": null, \"idOfContainingCollection\": null, " + "\"relatedResourceId\": null, \"providerId\": null, \"derivedFrom\": null, \"associatedSpecimenReference\": null, " + "\"associatedObservationReference\": null, \"locationCreated\": null, \"digitizationDate\": null, \"captureDevice\": null, " + "\"resourceCreationTechnique\": \"bitrate: 320000 bps; bitrate mode: cbr; audio sampling rate: 44100 Hz; number of channels: 2; lossy\", " + "\"accessUri\": \"https: + "\"format\": \"audio/mpeg\", \"formatUri\": null, \"variantLiteral\": \"ac:BestQuality\", \"variant\": null, \"variantDescription\": null, " + "\"furtherInformationUrl\": null, \"licensingException\": null, \"serviceExpectation\": null, \"hashFunction\": null, \"hashValue\": null, " + "\"PixelXDimension\": null, \"PixelYDimension\": null, \"taxonCoverage\": null, \"scientificName\": null, \"identificationQualifier\": null, " + "\"vernacularName\": null, \"nameAccordingTo\": null, \"scientificNameId\": null, \"otherScientificName\": null, \"identifiedBy\": null, " + "\"dateIdentified\": null, \"taxonCount\": null, \"subjectPart\": null, \"sex\": null, \"lifeStage\": null, \"subjectOrientation\": null, " + "\"preparations\": null, \"temporal\": null, \"createDate\": null, \"timeOfDay\": null}, {\"creator\": null, \"creatorUri\": " + "\"Stichting Xeno-canto voor Natuurgeluiden\", \"providerLiteral\": null, \"provider\": null, \"metadataCreatorLiteral\": null, " + "\"metadataCreator\": null, \"metadataProviderLiteral\": null, \"metadataProvider\": null, \"rights\": \"http: + "\"rightsUri\": \"http: + "\"usageTerms\": null, \"webStatement\": null, \"licenseLogoUrl\": null, \"credit\": null, \"attributionLogoUrl\": null, " + "\"attributionLinkUrl\": null, \"fundingAttribution\": null, \"source\": null, \"sourceUri\": null, \"description\": null, " + "\"caption\": \"Sonogram of the first ten seconds of the sound recording\", \"language\": null, \"languageUri\": null, " + "\"physicalSetting\": null, \"cvTerm\": null, \"subjectCategoryVocabulary\": null, \"tag\": null, \"locationShown\": null, " + "\"worldRegion\": null, \"countryCode\": null, \"countryName\": null, \"provinceState\": null, \"city\": null, \"sublocation\": null, " + "\"identifier\": \"https: + "\"subtypeLiteral\": null, \"subtype\": null, \"title\": null, \"modified\": null, \"metadataDate\": null, " + "\"metadataLanguageLiteral\": null, \"metadataLanguage\": null, \"providerManagedId\": null, \"rating\": null, \"commenterLiteral\": null, " + "\"commenter\": null, \"comments\": null, \"reviewerLiteral\": null, \"reviewer\": null, \"reviewerComments\": null, \"available\": null, " + "\"hasServiceAccessPoint\": null, \"idOfContainingCollection\": null, \"relatedResourceId\": null, \"providerId\": null," + " \"derivedFrom\": null, \"associatedSpecimenReference\": null, \"associatedObservationReference\": null, \"locationCreated\": null, " + "\"digitizationDate\": null, \"captureDevice\": null, \"resourceCreationTechnique\": null, \"accessUri\": " + "\"https: + "\"variantLiteral\": \"ac:MediumQuality\", \"variant\": null, \"variantDescription\": null, \"furtherInformationUrl\": null, " + "\"licensingException\": null, \"serviceExpectation\": null, \"hashFunction\": null, \"hashValue\": null, \"PixelXDimension\": null, " + "\"PixelYDimension\": null, \"taxonCoverage\": null, \"scientificName\": null, \"identificationQualifier\": null, \"vernacularName\": null, " + "\"nameAccordingTo\": null, \"scientificNameId\": null, \"otherScientificName\": null, \"identifiedBy\": null, \"dateIdentified\": null, " + "\"taxonCount\": null, \"subjectPart\": null, \"sex\": null, \"lifeStage\": null, \"subjectOrientation\": null, \"preparations\": null," + " \"temporal\": null, \"createDate\": null, \"timeOfDay\": null}], \"issues\": {\"issueList\": []}}"; Map<String, List<Map<String, String>>> ext = new HashMap<>(2); Map<String, String> audubon1 = new HashMap<>(10); audubon1.put("http: audubon1.put("http: audubon1.put( "http: "https: audubon1.put("http: audubon1.put( "http: "bitrate: 320000 bps; bitrate mode: cbr; audio sampling rate: 44100 Hz; number of channels: 2; lossy"); audubon1.put("http: audubon1.put( "http: "https: audubon1.put("http: audubon1.put("http: audubon1.put("http: Map<String, String> audubon2 = new HashMap<>(9); audubon2.put("http: audubon2.put("http: audubon2.put( "http: "Sonogram of the first ten seconds of the sound recording"); audubon2.put( "http: "https: audubon2.put("http: audubon2.put( "http: "https: audubon2.put("http: audubon2.put( "http: audubon2.put("http: ext.put("http: ExtendedRecord er = ExtendedRecord.newBuilder().setId("id").setExtensions(ext).build(); AudubonRecord ar = AudubonRecord.newBuilder().setId("id").build(); AudubonInterpreter.builder().create().interpret(er, ar); Assert.assertEquals(expected, ar.toString()); }
public void interpret(ExtendedRecord er, AudubonRecord ar) { Objects.requireNonNull(er); Objects.requireNonNull(ar); Result<Audubon> result = handler.convert(er); ar.setAudubonItems(result.getList()); ar.getIssues().setIssueList(result.getIssuesAsList()); }
AudubonInterpreter { public void interpret(ExtendedRecord er, AudubonRecord ar) { Objects.requireNonNull(er); Objects.requireNonNull(ar); Result<Audubon> result = handler.convert(er); ar.setAudubonItems(result.getList()); ar.getIssues().setIssueList(result.getIssuesAsList()); } }
AudubonInterpreter { public void interpret(ExtendedRecord er, AudubonRecord ar) { Objects.requireNonNull(er); Objects.requireNonNull(ar); Result<Audubon> result = handler.convert(er); ar.setAudubonItems(result.getList()); ar.getIssues().setIssueList(result.getIssuesAsList()); } @Builder(buildMethodName = "create") private  AudubonInterpreter(
      List<DateComponentOrdering> orderings,
      SerializableFunction<String, String> preprocessDateFn); }
AudubonInterpreter { public void interpret(ExtendedRecord er, AudubonRecord ar) { Objects.requireNonNull(er); Objects.requireNonNull(ar); Result<Audubon> result = handler.convert(er); ar.setAudubonItems(result.getList()); ar.getIssues().setIssueList(result.getIssuesAsList()); } @Builder(buildMethodName = "create") private  AudubonInterpreter(
      List<DateComponentOrdering> orderings,
      SerializableFunction<String, String> preprocessDateFn); void interpret(ExtendedRecord er, AudubonRecord ar); }
AudubonInterpreter { public void interpret(ExtendedRecord er, AudubonRecord ar) { Objects.requireNonNull(er); Objects.requireNonNull(ar); Result<Audubon> result = handler.convert(er); ar.setAudubonItems(result.getList()); ar.getIssues().setIssueList(result.getIssuesAsList()); } @Builder(buildMethodName = "create") private  AudubonInterpreter(
      List<DateComponentOrdering> orderings,
      SerializableFunction<String, String> preprocessDateFn); void interpret(ExtendedRecord er, AudubonRecord ar);  }