Pārlūkot izejas kodu

Fixed some testing

Trinh Tong 6 gadus atpakaļ
vecāks
revīzija
db212675a9

+ 4
- 4
trtongorm_lab/src/main/java/AcctService.java Parādīt failu

@@ -12,9 +12,9 @@ public class AcctService{
12 12
         this.dao = dao;
13 13
     }
14 14
 
15
-    public void create(Account account) throws Exception {
15
+    public int create(Account account) throws Exception {
16 16
 
17
-        dao.create(account);
17
+        return dao.create(account);
18 18
     }
19 19
 
20 20
     public List<Account> read() throws Exception {
@@ -49,8 +49,8 @@ public class AcctService{
49 49
         }
50 50
     }
51 51
 
52
-    public void destroy(Account a) throws SQLException {
53
-        dao.delete(a);
52
+    public int destroy(Account a) throws SQLException {
53
+        return dao.delete(a);
54 54
     }
55 55
 
56 56
     public void readAllAccounts(List<Account> moo) {

+ 2
- 2
trtongorm_lab/src/test/java/AcctServiceTest.java Parādīt failu

@@ -22,7 +22,7 @@ public class AcctServiceTest {
22 22
     @Test
23 23
     public void testCreate() throws Exception {
24 24
         int exp = 500;
25
-        int actual = dao.create(new Account("Biggie", "Moot"));
25
+        int actual = testService.create(new Account("Biggie", "Moot"));
26 26
         Assert.assertEquals(exp, actual);
27 27
     }
28 28
 
@@ -40,7 +40,7 @@ public class AcctServiceTest {
40 40
     @Test
41 41
     public void testDelete() throws SQLException {
42 42
 
43
-        int actual = dao.delete(acc);
43
+        int actual = testService.destroy(acc);
44 44
         Assert.assertEquals(666, actual);
45 45
     }
46 46