@Test public void test4Tokens_PersonFirstWithYear_HasVolume() throws Exception { ReferenceDataParser result = runTest( PERSON_STRING + ", " + YEAR + ", " + SOURCE_STRING + ", " + VOLUME_STRING, true, true); int resultVolume = result.getVolume(); if (resultVolume != VOLUME_NUMBER) { fail("Result volume (" + resultVolume + ") != " + VOLUME_NUMBER); } }
@Test public void test4Tokens_Invalid() throws Exception { ReferenceDataParser result = runTest(", , , ", true, false); Source resultSource = result.getSource(); Integer resultYear = result.getYear(); Integer resultVolume = result.getVolume(); Integer resultPageNumber = result.getPageNumber(); if (resultSource != null) { if (!StringUtilities.isNull_Empty_OrWhitespace( resultSource.get29CharacterSourceTitleAbbreviation()) || (resultYear != IntegerParserWithDefault.DEFAULT) || (resultVolume != IntegerParserWithDefault.DEFAULT) || (resultPageNumber != IntegerParserWithDefault.DEFAULT)) { String failMessage = "Result should be invalid. Instead, it has:" + "\n\tSource: \"" + resultSource + "\"" + "\n\tYear: \"" + resultYear + "\"" + "\n\tVolume: \"" + resultVolume + "\"" + "\n\tPage number: \"" + resultPageNumber + "\""; fail(failMessage); } } else { if ((resultSource != null) || (resultYear != IntegerParserWithDefault.DEFAULT) || (resultVolume != IntegerParserWithDefault.DEFAULT) || (resultPageNumber != IntegerParserWithDefault.DEFAULT)) { String failMessage = "Result should be invalid. Instead, it has:" + "\n\tSource: \"" + resultSource + "\"" + "\n\tYear: \"" + resultYear + "\"" + "\n\tVolume: \"" + resultVolume + "\"" + "\n\tPage number: \"" + resultPageNumber + "\""; fail(failMessage); } } }
@Test public void test4Tokens_YearFirst_Volume() throws Exception { ReferenceDataParser result = runTest( YEAR + ", " + SOURCE_STRING + ", " + VOLUME_STRING + ", " + PAGE_NUMBER_STRING, true, true); int resultVolume = result.getVolume(); if (resultVolume != VOLUME_NUMBER) { fail("Result volume (" + resultVolume + ") != " + VOLUME_NUMBER); } }