File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
src/test/java/com/redhat/labs/omp Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,9 @@ public List<Group> getGroupByName(String name) {
61
61
groupList .add (Group .builder ().id (3 ).name ("customer1" ).path ("customer1" ).build ());
62
62
} else if ("project4" .equalsIgnoreCase (name )) {
63
63
groupList .add (Group .builder ().id (4 ).name ("project1" ).path ("project1" ).build ());
64
+ } else if ("customer" .equalsIgnoreCase (name )) {
65
+ groupList .add (Group .builder ().id (11 ).name ("customerA" ).path ("customerA" ).parentId (10 ).build ());
66
+ groupList .add (Group .builder ().id (12 ).name ("customer" ).path ("customer" ).parentId (10 ).build ());
64
67
}
65
68
66
69
return groupList ;
Original file line number Diff line number Diff line change
1
+ package com .redhat .labs .omp .service ;
2
+
3
+ import java .util .Optional ;
4
+
5
+ import javax .inject .Inject ;
6
+
7
+ import org .junit .jupiter .api .Assertions ;
8
+ import org .junit .jupiter .api .Test ;
9
+
10
+ import com .redhat .labs .omp .models .gitlab .Group ;
11
+
12
+ import io .quarkus .test .junit .QuarkusTest ;
13
+
14
+ @ QuarkusTest
15
+ public class GroupServiceTest {
16
+
17
+ @ Inject
18
+ GroupService groupService ;
19
+
20
+ @ Test
21
+ public void testGetGitLabGroupByNameNoGroupsExist () {
22
+
23
+ Optional <Group > optional = groupService .getGitLabGroupByName ("customerA" , 1 );
24
+ Assertions .assertFalse (optional .isPresent ());
25
+
26
+ }
27
+
28
+ @ Test
29
+ public void testGetGitLabGroupByNameMultipleGroupsExistNoMatch () {
30
+
31
+ Optional <Group > optional = groupService .getGitLabGroupByName ("customer" , 1 );
32
+ Assertions .assertFalse (optional .isPresent ());
33
+
34
+ }
35
+
36
+ @ Test
37
+ public void testGetGitLabGroupByNameMultipleGroupsExistMatch () {
38
+
39
+ Optional <Group > optional = groupService .getGitLabGroupByName ("customer" , 10 );
40
+ Assertions .assertTrue (optional .isPresent ());
41
+
42
+ }
43
+
44
+ }
You can’t perform that action at this time.
0 commit comments