Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit e5ffceb

Browse files
author
Evgenii Kanivets
committed
#142[1h]. Fix tests.
1 parent 0913461 commit e5ffceb

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

app/src/androidTest/java/com/blogspot/e_kanivets/moneytracker/repo/data/AccountRepoTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void testGetTable() throws Exception {
4040
}
4141

4242
public void testContentValues() throws Exception {
43-
Account account = new Account(-1, "title1", 100, "NON", 30);
43+
Account account = new Account(-1, "title1", 100, "NON", 30, 0, false, 0);
4444

4545
ContentValues expected = new ContentValues();
4646
expected.put(DbHelper.TITLE_COLUMN, "title1");
@@ -71,7 +71,7 @@ public void testGetListFromCursor() throws Exception {
7171
Mockito.when(mockCursor.getString(4)).thenReturn("NON");
7272

7373
List<Account> expected = new ArrayList<>();
74-
expected.add(new Account(1, "title", 100, "NON", 0));
74+
expected.add(new Account(1, "title", 100, "NON", 0, 0, false, 0));
7575

7676
assertEquals(expected, repo.getListFromCursor(mockCursor));
7777

app/src/test/java/com/blogspot/e_kanivets/moneytracker/controller/CurrencyControllerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void testReadDefaultCurrency() throws Exception {
2626
Mockito.when(accountMock.readDefaultAccount()).thenReturn(null);
2727
assertEquals("NON", currencyController.readDefaultCurrency());
2828

29-
Account account = new Account(1, "a1", 100, "ACM", 0);
29+
Account account = new Account(1, "a1", 100, "ACM", 0, 0, false, 0);
3030
Mockito.when(prefsMock.readDefaultCurrency()).thenReturn(null);
3131
Mockito.when(accountMock.readDefaultAccount()).thenReturn(account);
3232
assertEquals(account.getCurrency(), currencyController.readDefaultCurrency());

app/src/test/java/com/blogspot/e_kanivets/moneytracker/controller/data/AccountControllerTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void tearDown() throws Exception {
5252
@Test
5353
public void testRecordAdded() throws Exception {
5454
Category category = new Category(1, "c1");
55-
Account account = new Account(1, "a1", 100, "NON", 0);
55+
Account account = new Account(1, "a1", 100, "NON", 0, 0, false, 0);
5656
repo.create(account);
5757

5858
Record income = new Record(1, 1, Record.TYPE_INCOME, "income", category, 10, account,
@@ -78,7 +78,7 @@ public void testRecordAdded() throws Exception {
7878
@Test
7979
public void testRecordDeleted() throws Exception {
8080
Category category = new Category(1, "c1");
81-
Account account = new Account(1, "a1", 100, "NON", 0);
81+
Account account = new Account(1, "a1", 100, "NON", 0, 0, false, 0);
8282
repo.create(account);
8383

8484
Record income = new Record(1, 1, Record.TYPE_INCOME, "income", category, 10, account,
@@ -104,7 +104,7 @@ public void testRecordDeleted() throws Exception {
104104
@Test
105105
public void testRecordUpdated() throws Exception {
106106
Category category = new Category(1, "c1");
107-
Account account = new Account(1, "a1", 100, "NON", 0);
107+
Account account = new Account(1, "a1", 100, "NON", 0, 0, false, 0);
108108
repo.create(account);
109109

110110
Record incomeOld = new Record(1, 1, Record.TYPE_INCOME, "income", category, 10, account,
@@ -139,8 +139,8 @@ public void testRecordUpdated() throws Exception {
139139

140140
@Test
141141
public void testTransferDone() throws Exception {
142-
Account account1 = new Account(1, "a1", 100, "NON", 0);
143-
Account account2 = new Account(2, "a2", 0, "NON", 0);
142+
Account account1 = new Account(1, "a1", 100, "NON", 0, 0, false, 0);
143+
Account account2 = new Account(2, "a2", 0, "NON", 0, 0, false, 0);
144144

145145
repo.create(account1);
146146
repo.create(account2);
@@ -174,11 +174,11 @@ public void testTransferDone() throws Exception {
174174
public void testReadDefaultAccount() throws Exception {
175175
assertNull(accountController.readDefaultAccount());
176176

177-
Account account1 = new Account(1, "a1", 100, "NON", 0);
177+
Account account1 = new Account(1, "a1", 100, "NON", 0, 0, false, 0);
178178
repo.create(account1);
179179
assertEquals(account1, accountController.readDefaultAccount());
180180

181-
Account account2 = new Account(2, "a2", 0, "NON", 0);
181+
Account account2 = new Account(2, "a2", 0, "NON", 0, 0, false, 0);
182182
repo.create(account2);
183183
assertEquals(account1, accountController.readDefaultAccount());
184184

app/src/test/java/com/blogspot/e_kanivets/moneytracker/controller/data/RecordControllerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void testCreate() throws Exception {
6060
Mockito.verify(accountMock, Mockito.times(0)).recordAdded(null);
6161

6262
Category category = new Category(1, "c1");
63-
Account account = new Account(1, "a1", 100, "NON", 0);
63+
Account account = new Account(1, "a1", 100, "NON", 0, 0, false, 0);
6464
Record record = new Record(1, 1, Record.TYPE_INCOME, "r1", category, 10, account, "NON");
6565
Mockito.when(categoryMock.readOrCreate(category.getName())).thenReturn(category);
6666

@@ -78,7 +78,7 @@ public void testUpdate() throws Exception {
7878
Mockito.verify(accountMock, Mockito.times(0)).recordAdded(null);
7979

8080
Category category = new Category(1, "c1");
81-
Account account = new Account(1, "a1", 100, "NON", 0);
81+
Account account = new Account(1, "a1", 100, "NON", 0, 0, false, 0);
8282
Record record = new Record(1, 1, Record.TYPE_INCOME, "r1", category, 10, account, "NON");
8383
Mockito.when(categoryMock.readOrCreate(category.getName())).thenReturn(category);
8484

@@ -95,7 +95,7 @@ public void testDelete() throws Exception {
9595
Mockito.verify(accountMock, Mockito.times(0)).recordDeleted(null);
9696

9797
Category category = new Category(1, "c1");
98-
Account account = new Account(1, "a1", 100, "NON", 0);
98+
Account account = new Account(1, "a1", 100, "NON", 0, 0, false, 0);
9999
Record record = new Record(1, 1, Record.TYPE_INCOME, "r1", category, 10, account, "NON");
100100

101101
assertFalse(recordController.delete(record));
@@ -112,7 +112,7 @@ public void testRead() throws Exception {
112112
assertNull(recordController.read(-1));
113113

114114
Category category = new Category(1, "c1");
115-
Account account = new Account(1, "a1", 100, "NON", 0);
115+
Account account = new Account(1, "a1", 100, "NON", 0, 0, false, 0);
116116
Record recordNotFull = new Record(1, 1, Record.TYPE_INCOME, "r1", category.getId(), 10,
117117
account.getId(), "NON", 0);
118118
Record record = new Record(1, 1, Record.TYPE_INCOME, "r1", category, 10, account, "NON");

app/src/test/java/com/blogspot/e_kanivets/moneytracker/report/ReportTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ public void testGetSummary() throws Exception {
175175
List<Record> recordList = new ArrayList<>();
176176

177177
Category category = new Category(1, "category");
178-
Account account1 = new Account(1, "account1", 100, "UAH", 0);
179-
Account account2 = new Account(2, "account2", 100, "USD", 0);
178+
Account account1 = new Account(1, "account1", 100, "UAH", 0, 0, false, 0);
179+
Account account2 = new Account(2, "account2", 100, "USD", 0, 0, false, 0);
180180

181181
Record record1 = new Record(1, 0, Record.TYPE_INCOME, "1", category, 10, account2, "USD");
182182
recordList.add(record1);
@@ -220,8 +220,8 @@ private List<Record> getRecordList() {
220220
List<Record> recordList = new ArrayList<>();
221221

222222
Category category = new Category(1, "category");
223-
Account account1 = new Account(1, "account1", 100, "UAH", 0);
224-
Account account2 = new Account(2, "account2", 100, "USD", 0);
223+
Account account1 = new Account(1, "account1", 100, "UAH", 0, 0, false, 0);
224+
Account account2 = new Account(2, "account2", 100, "USD", 0, 0, false, 0);
225225

226226
Record record1 = new Record(1, 0, Record.TYPE_INCOME, "1", category, 10, account2, "USD");
227227
recordList.add(record1);

0 commit comments

Comments
 (0)