Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Legal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
Security and Compliance
Legal
Commits
967c7ab5
Commit
967c7ab5
authored
4 years ago
by
Aalekh Jain
Browse files
Options
Downloads
Patches
Plain Diff
Added UTs for `delete` method in `LegalTagRepositoryImpl.java`
parent
d7a2d966
Branches
trusted-EPMOSDU-1401-sast-fix
Branches containing commit
No related tags found
1 merge request
!61
Improve code coverage
Pipeline
#9582
failed
4 years ago
Stage: build
Stage: scan
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
provider/legal-azure/src/test/java/org/opengroup/osdu/legal/azure/tags/dataaccess/LegalTagRepositoryImplTest.java
+26
-0
26 additions, 0 deletions
...gal/azure/tags/dataaccess/LegalTagRepositoryImplTest.java
with
26 additions
and
0 deletions
provider/legal-azure/src/test/java/org/opengroup/osdu/legal/azure/tags/dataaccess/LegalTagRepositoryImplTest.java
+
26
−
0
View file @
967c7ab5
...
...
@@ -74,6 +74,32 @@ public class LegalTagRepositoryImplTest {
assertEquals
(
output
.
get
(
1
).
getId
().
longValue
(),
ids
[
1
]);
}
@Test
public
void
testDeleteLegalTag_whenLegalTagDoesNotExist
()
{
long
id
=
0
;
LegalTag
legalTag
=
getLegalTagWithId
(
id
);
boolean
status
=
sut
.
delete
(
legalTag
);
assertEquals
(
status
,
false
);
}
@Test
public
void
testDeleteLegalTag_whenLegalTagExists
()
{
long
id
=
0
;
String
strId
=
String
.
valueOf
(
id
);
LegalTag
l
=
getLegalTagWithId
(
id
);
Optional
<
LegalTag
>
legalTag
=
Optional
.
of
(
l
);
doReturn
(
legalTag
).
when
(
cosmosStore
).
findItem
(
eq
(
dataPartitionId
),
any
(),
any
(),
eq
(
strId
),
eq
(
strId
),
any
());
boolean
status
=
sut
.
delete
(
l
);
ArgumentCaptor
<
String
>
arg1
=
ArgumentCaptor
.
forClass
(
String
.
class
);
ArgumentCaptor
<
String
>
arg2
=
ArgumentCaptor
.
forClass
(
String
.
class
);
verify
(
cosmosStore
).
deleteItem
(
anyString
(),
any
(),
any
(),
arg1
.
capture
(),
arg2
.
capture
());
assertEquals
(
status
,
true
);
assertEquals
(
arg1
.
getValue
(),
strId
);
assertEquals
(
arg2
.
getValue
(),
strId
);
}
private
LegalTag
getLegalTagWithId
(
long
id
)
{
LegalTag
legalTag
=
new
LegalTag
();
legalTag
.
setId
(
id
);
...
...
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