Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BudgetMaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robert Goldmann
BudgetMaster
Commits
11813b43
Commit
11813b43
authored
3 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
#676 - fixed unit tests
parent
36548038
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/de/deadlocker8/budgetmaster/unit/AccountServiceTest.java
+11
-0
11 additions, 0 deletions
.../de/deadlocker8/budgetmaster/unit/AccountServiceTest.java
with
11 additions
and
0 deletions
src/test/java/de/deadlocker8/budgetmaster/unit/AccountServiceTest.java
+
11
−
0
View file @
11813b43
...
@@ -3,6 +3,7 @@ package de.deadlocker8.budgetmaster.unit;
...
@@ -3,6 +3,7 @@ package de.deadlocker8.budgetmaster.unit;
import
de.deadlocker8.budgetmaster.accounts.*
;
import
de.deadlocker8.budgetmaster.accounts.*
;
import
de.deadlocker8.budgetmaster.authentication.UserRepository
;
import
de.deadlocker8.budgetmaster.authentication.UserRepository
;
import
de.deadlocker8.budgetmaster.icon.Icon
;
import
de.deadlocker8.budgetmaster.icon.Icon
;
import
de.deadlocker8.budgetmaster.icon.IconRepository
;
import
de.deadlocker8.budgetmaster.icon.IconService
;
import
de.deadlocker8.budgetmaster.icon.IconService
;
import
de.deadlocker8.budgetmaster.transactions.TransactionService
;
import
de.deadlocker8.budgetmaster.transactions.TransactionService
;
import
de.deadlocker8.budgetmaster.unit.helpers.LocalizedTest
;
import
de.deadlocker8.budgetmaster.unit.helpers.LocalizedTest
;
...
@@ -37,6 +38,9 @@ class AccountServiceTest
...
@@ -37,6 +38,9 @@ class AccountServiceTest
@Mock
@Mock
private
IconService
iconService
;
private
IconService
iconService
;
@Mock
private
IconRepository
iconRepository
;
private
AccountService
accountService
;
private
AccountService
accountService
;
private
Account
ACCOUNT_DEFAULT
;
private
Account
ACCOUNT_DEFAULT
;
...
@@ -45,6 +49,8 @@ class AccountServiceTest
...
@@ -45,6 +49,8 @@ class AccountServiceTest
private
Account
ACCOUNT_READONLY
;
private
Account
ACCOUNT_READONLY
;
private
Account
ACCOUNT_HIDDEN
;
private
Account
ACCOUNT_HIDDEN
;
private
Icon
ICON_PLACEHOLDER
;
@BeforeEach
@BeforeEach
void
beforeEach
()
void
beforeEach
()
{
{
...
@@ -65,12 +71,17 @@ class AccountServiceTest
...
@@ -65,12 +71,17 @@ class AccountServiceTest
ACCOUNT_DEFAULT
.
setID
(
15
);
ACCOUNT_DEFAULT
.
setID
(
15
);
ACCOUNT_DEFAULT
.
setDefault
(
true
);
ACCOUNT_DEFAULT
.
setDefault
(
true
);
ICON_PLACEHOLDER
=
new
Icon
(
"fas fa-landmark"
,
null
);
Mockito
.
when
(
accountRepository
.
save
(
new
Account
(
Localization
.
getString
(
Strings
.
ACCOUNT_DEFAULT_NAME
),
AccountType
.
CUSTOM
))).
thenReturn
(
ACCOUNT_DEFAULT
);
Mockito
.
when
(
accountRepository
.
save
(
new
Account
(
Localization
.
getString
(
Strings
.
ACCOUNT_DEFAULT_NAME
),
AccountType
.
CUSTOM
))).
thenReturn
(
ACCOUNT_DEFAULT
);
Mockito
.
when
(
accountRepository
.
findByIsDefault
(
true
)).
thenReturn
(
ACCOUNT_DEFAULT
);
Mockito
.
when
(
accountRepository
.
findByIsDefault
(
true
)).
thenReturn
(
ACCOUNT_DEFAULT
);
Mockito
.
when
(
accountRepository
.
findAllByType
(
AccountType
.
ALL
)).
thenReturn
(
List
.
of
(
ACCOUNT_PLACEHOLDER
));
Mockito
.
when
(
accountRepository
.
findAllByType
(
AccountType
.
ALL
)).
thenReturn
(
List
.
of
(
ACCOUNT_PLACEHOLDER
));
Mockito
.
when
(
accountRepository
.
findById
(
1
)).
thenReturn
(
Optional
.
of
(
ACCOUNT_PLACEHOLDER
));
Mockito
.
when
(
accountRepository
.
findById
(
1
)).
thenReturn
(
Optional
.
of
(
ACCOUNT_PLACEHOLDER
));
Mockito
.
when
(
accountRepository
.
findById
(
3
)).
thenReturn
(
Optional
.
of
(
ACCOUNT_NORMAL
));
Mockito
.
when
(
accountRepository
.
findById
(
3
)).
thenReturn
(
Optional
.
of
(
ACCOUNT_NORMAL
));
Mockito
.
when
(
iconService
.
getRepository
()).
thenReturn
(
iconRepository
);
Mockito
.
when
(
iconRepository
.
save
(
new
Icon
(
"fas fa-landmark"
,
null
))).
thenReturn
(
ICON_PLACEHOLDER
);
accountService
=
new
AccountService
(
accountRepository
,
transactionService
,
userRepository
,
iconService
);
accountService
=
new
AccountService
(
accountRepository
,
transactionService
,
userRepository
,
iconService
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment