use of org.nextprot.api.web.service.impl.writer.EntryTXTStreamWriter in project nextprot-api by calipho-sib.
the class ExportTXTHeaderTest method shouldContainTheNumberOfEntriesInTheHeader.
// TEST for https://issues.isb-sib.ch/browse/CALIPHOMISC-330
@Test
public void shouldContainTheNumberOfEntriesInTheHeader() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
Writer writer = new PrintWriter(out);
EntryVelocityBasedStreamWriter exporter = new EntryTXTStreamWriter(writer);
exporter.setEntryBuilderService(entryBuilderMockService);
when(entryBuilderMockService.build(any(EntryConfig.class))).thenReturn(new Entry("NX_1")).thenReturn(new Entry("NX_2"));
Map<String, Object> infos = new HashMap<>();
infos.put(EntryStreamWriter.getReleaseInfoKey(), Mockito.mock(ReleaseInfoVersions.class));
exporter.write(Arrays.asList("NX_1", "NX_2"), infos);
String[] rows = out.toString().split(StringUtils.CR_LF);
assertEquals(rows[0], "#nb entries=2");
assertEquals(rows[1], "NX_1");
assertEquals(rows[2], "NX_2");
}
Aggregations