/** Test of loadBelegById method, of class BelegService. */ @Test public void testLoadBelegById() throws Exception { System.out.println("loadBelegById"); BelegSearchRequest searchReq = new BelegSearchRequest(); searchReq.setSearchType(SearchType.ALL_RECORDS); searchReq.setBelegType(BelegTyp.AUFTRAG); searchReq.setLimit(10); searchReq.setMandantenId(2); List<BelegKopfDTO> beList = testee.searchBeleg(searchReq); assertNotNull("searchBelege, Liste hat keine Einträge", beList); assertEquals("searchBelege, Liste hat keine 10 Einträge", 10, beList.size()); BaseDTO expResult = (BaseDTO) beList.get(2); BelegDTO result = testee.loadBelegById(BelegTyp.AUFTRAG, expResult.getId()); BaseDTO testResult = (BaseDTO) result; assertEquals("Beleg nicht geladen ID=" + expResult.getId(), expResult, testResult); }
/** Test of createBeleg method, of class BelegService. */ @Test public void testCreateBeleg() throws Exception { System.out.println("createBeleg"); BelegDTO expResult = createTestBeleg(); BelegDTO result = testee.createBeleg(expResult); assertNotNull("Beleg.ID ==null", result.getId()); assertTrue("Beleg.ID ==0", result.getId() > 0); compareBelege(expResult, result); testee.deleteBeleg(result); BelegDTO delBeleg = null; try { delBeleg = testee.loadBelegById(result.getBelegTyp(), result.getId()); } catch (TomException tomException) { // Excpected } assertNull("Error deleting Beleg " + delBeleg, delBeleg); }