### Question:
CitationUtil { public static String citationOrDefaultFor(Dataset dataset, String defaultCitation) { Set<String> secondaryCitations = new TreeSet<>(); JsonNode config = dataset.getConfig(); if (config != null && config.has("tables")) { JsonNode tables = config.get("tables"); for (JsonNode table : tables) { if (table.has(PropertyAndValueDictionary.DCTERMS_BIBLIOGRAPHIC_CITATION)) { String secondaryCitation = table .get(PropertyAndValueDictionary.DCTERMS_BIBLIOGRAPHIC_CITATION) .getTextValue(); if (StringUtils.isNotBlank(secondaryCitation)) { secondaryCitations.add(secondaryCitation); } } } } String secondaryCitationsJoin = StringUtils.join(secondaryCitations, "; "); String fallbackCitation = StringUtils.isBlank(secondaryCitationsJoin) ? defaultCitation : secondaryCitationsJoin; String primaryCitation = dataset .getOrDefault(PropertyAndValueDictionary.DCTERMS_BIBLIOGRAPHIC_CITATION, dataset.getOrDefault("citation", fallbackCitation)); return StringUtils.trim(StringUtils.isBlank(primaryCitation) ? secondaryCitationsJoin : primaryCitation); }  static String createLastAccessedString(URI reference); static String createLastAccessedString(String reference); static String sourceCitationLastAccessed(Dataset dataset, String sourceCitation); static String sourceCitationLastAccessed(Dataset dataset); static String citationFor(Dataset dataset); static String citationOrDefaultFor(Dataset dataset, String defaultCitation); static DOI getDOI(Dataset dataset);  }### Answer:
@Test public void citationDefault() throws IOException { Dataset dataset = Mockito.mock(Dataset.class); when(dataset.getConfig()).thenReturn(new ObjectMapper().readTree("{\n" + " \"@context\": [\"http: " \"rdfs:comment\": [\"inspired by https: " \"tables\": [\n" + " { \"url\": \"interactions.tsv\",\n" + " \"dcterms:bibliographicCitation\": \"Gandhi, K. J. K., & Herms, D. A. (2009). North American arthropods at risk due to widespread Fraxinus mortality caused by the Alien Emerald ash borer. Biological Invasions, 12(6), 1839–1846. doi:10.1007/s10530-009-9594-1.\",\n" + " \"doi\": \"10.1007/s10530-009-9594-1\",\n" + " \"tableSchema\": \"interactions.tsv-schema.json\",\n" + " \"headerRowCount\": 1,\n" + " \"delimiter\": \"\\t\",\n" + " \"interactionTypeId\": \"http: " \"interactionTypeName\": \"interactsWith\"\n" + " }\n" + " ]\n" + "}")); String citation = CitationUtil.citationOrDefaultFor(dataset, "foo"); assertThat(citation, Is.is("Gandhi, K. J. K., & Herms, D. A. (2009). North American arthropods at risk due to widespread Fraxinus mortality caused by the Alien Emerald ash borer. Biological Invasions, 12(6), 1839–1846. doi:10.1007/s10530-009-9594-1.")); }