@Test public void testClosingTwice() throws Exception { DbUnitEntityExporter exporter = new DbUnitEntityExporter(FILENAME); exporter.startProductConsumption(ALICE); exporter.finishProductConsumption(ALICE); exporter.close(); exporter.close(); }
@Test public void test() throws Exception { DbUnitEntityExporter exporter = new DbUnitEntityExporter(FILENAME); exporter.startProductConsumption(ALICE); exporter.startProductConsumption(BOB); exporter.finishProductConsumption(BOB); exporter.finishProductConsumption(ALICE); exporter.close(); Document doc = XMLUtil.parse(FILENAME); Element root = doc.getDocumentElement(); Element[] children = XMLUtil.getChildElements(root); assertEquals(2, children.length); assertPerson(children[0], "Alice", 23); assertPerson(children[1], "Bob", 34); FileUtil.deleteIfExists(new File(FILENAME)); }
@Test public void testUnusedClose() throws Exception { DbUnitEntityExporter exporter = new DbUnitEntityExporter(FILENAME); exporter.close(); }