/** Test of searchBeleg method, of class BelegService. */ @Test public void testSearchBeleg() throws Exception { System.out.println("searchBeleg"); BelegSearchRequest searchReq = new BelegSearchRequest(); searchReq.setSearchType(SearchType.ALL_RECORDS); searchReq.setBelegType(BelegTyp.AUFTRAG); searchReq.setLimit(10); searchReq.setMandantenId(2); List result = testee.searchBeleg(searchReq); assertNotNull("searchBelege, Liste hat keine Einträge", result); assertEquals("searchBelege, Liste hat keine 10 Einträge", 10, result.size()); }
/** 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 checkBelegByNumber method, of class BelegService. */ @Ignore @Test public void testCheckBelegByNumber() throws Exception { System.out.println("checkBelegByNumber"); 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 10 Einträge", beList); assertEquals("searchBelege, Liste hat keine 10 Einträge", 10, beList.size()); BaseDTO expResult = (BaseDTO) beList.get(3); Integer belegNr = beList.get(3).getNummer(); boolean result = testee.checkBelegByNumber(BelegTyp.AUFTRAG, belegNr); assertTrue("result should be true but was false", result); boolean result2 = testee.checkBelegByNumber(BelegTyp.AUFTRAG, -1); assertFalse("result should be false but was true", result2); }