@Test public void testLoadSortConfigurationTitleAscAndEditionDesc() throws Exception { InputStream configFile = Thread.currentThread() .getContextClassLoader() .getResourceAsStream("config/TitleAscAndEditionDesc.xml"); SortConfiguration sortConfiguration = xmlSortConfigurationLoader.loadSortConfiguration(configFile); Iterator<SortAttribute> sortAttributeIterator = sortConfiguration.iterator(); SortAttribute titleAsc = sortAttributeIterator.next(); assertEquals(SortAttribute.Attribute.TITLE, titleAsc.getAttribute()); assertEquals(SortAttribute.Direction.ASC, titleAsc.getDirection()); SortAttribute editionDesc = sortAttributeIterator.next(); assertEquals(SortAttribute.Attribute.EDITION, editionDesc.getAttribute()); assertEquals(SortAttribute.Direction.DESC, editionDesc.getDirection()); assertFalse(sortAttributeIterator.hasNext()); }
@Test public void testLoadSortConfigurationAuthorAsc() throws LoadingSortConfigurationException { InputStream configFile = Thread.currentThread().getContextClassLoader().getResourceAsStream("config/AuthorAsc.xml"); SortConfiguration sortConfiguration = xmlSortConfigurationLoader.loadSortConfiguration(configFile); Iterator<SortAttribute> sortAttributeIterator = sortConfiguration.iterator(); SortAttribute titleAsc = sortAttributeIterator.next(); assertEquals(SortAttribute.Attribute.AUTHOR, titleAsc.getAttribute()); assertEquals(SortAttribute.Direction.ASC, titleAsc.getDirection()); assertFalse(sortAttributeIterator.hasNext()); }