Skip to content

Commit c4740be

Browse files
committed
Reformatting code, refactoring
1 parent cd83fc4 commit c4740be

1 file changed

Lines changed: 29 additions & 32 deletions

File tree

src/test/java/org/folio/dataexp/service/ConsortiaServiceTest.java

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
import static org.assertj.core.api.Assertions.assertThat;
55
import static org.junit.jupiter.api.Assertions.assertEquals;
66
import static org.mockito.Mockito.verify;
7+
import static org.mockito.Mockito.verifyNoMoreInteractions;
78
import static org.mockito.Mockito.when;
89

10+
import java.util.Collections;
911
import java.util.List;
1012
import org.folio.dataexp.TestMate;
1113
import org.folio.dataexp.client.ConsortiaClient;
@@ -20,8 +22,6 @@
2022
import org.mockito.InjectMocks;
2123
import org.mockito.Mock;
2224
import org.mockito.junit.jupiter.MockitoExtension;
23-
import static org.mockito.Mockito.verifyNoMoreInteractions;
24-
import java.util.Collections;
2525

2626
@ExtendWith(MockitoExtension.class)
2727
class ConsortiaServiceTest {
@@ -129,10 +129,9 @@ void isCurrentTenantCentralTenantShouldReturnFalseWhenNoCentralTenantFound() {
129129
verify(folioExecutionContext).getTenantId();
130130
}
131131

132-
@Test
133-
@TestMate(name = "TestMate-getAffiliatedTenantsShouldReturnEmptyListWhenNoConsortiaExist")
132+
@Test
133+
@TestMate(name = "TestMate-eb6edcef2540a52e4d208cfd0cdeb101")
134134
void getAffiliatedTenantsShouldReturnEmptyListWhenNoConsortiaExist() {
135-
// TestMate-eb6edcef2540a52e4d208cfd0cdeb101
136135
// Given
137136
var tenantId = "any-tenant";
138137
var userId = "any-user";
@@ -147,35 +146,33 @@ void getAffiliatedTenantsShouldReturnEmptyListWhenNoConsortiaExist() {
147146
verifyNoMoreInteractions(consortiumClient);
148147
}
149148

150-
@Test
151-
@TestMate(name = "TestMate-getAffiliatedTenantsShouldReturnEmptyListWhenUserHasNoAffiliations")
152-
void getAffiliatedTenantsShouldReturnEmptyListWhenUserHasNoAffiliations() {
153-
// TestMate-23cbd8203e563263f4f0047eafc6b315
154-
// Given
155-
var consortiumId = "cons-1";
156-
var userId = "unlinked-user";
157-
var currentTenantId = "tenant-1";
158-
var consortia = new Consortia();
159-
consortia.setId(consortiumId);
160-
var consortiaCollection = new ConsortiaCollection();
161-
consortiaCollection.setConsortia(List.of(consortia));
162-
var emptyUserTenantCollection = new UserTenantCollection();
163-
emptyUserTenantCollection.setUserTenants(List.of());
164-
when(consortiumClient.getConsortia()).thenReturn(consortiaCollection);
165-
when(consortiumClient.getConsortiaUserTenants(consortiumId, userId, Integer.MAX_VALUE))
166-
.thenReturn(emptyUserTenantCollection);
167-
// When
168-
var result = consortiaService.getAffiliatedTenants(currentTenantId, userId);
169-
// Then
170-
assertThat(result).isEmpty();
171-
verify(consortiumClient).getConsortia();
172-
verify(consortiumClient).getConsortiaUserTenants(consortiumId, userId, Integer.MAX_VALUE);
173-
}
149+
@Test
150+
@TestMate(name = "TestMate-23cbd8203e563263f4f0047eafc6b315")
151+
void getAffiliatedTenantsShouldReturnEmptyListWhenUserHasNoAffiliations() {
152+
// Given
153+
var consortiumId = "cons-1";
154+
var userId = "unlinked-user";
155+
var currentTenantId = "tenant-1";
156+
var consortia = new Consortia();
157+
consortia.setId(consortiumId);
158+
var consortiaCollection = new ConsortiaCollection();
159+
consortiaCollection.setConsortia(List.of(consortia));
160+
var emptyUserTenantCollection = new UserTenantCollection();
161+
emptyUserTenantCollection.setUserTenants(List.of());
162+
when(consortiumClient.getConsortia()).thenReturn(consortiaCollection);
163+
when(consortiumClient.getConsortiaUserTenants(consortiumId, userId, Integer.MAX_VALUE))
164+
.thenReturn(emptyUserTenantCollection);
165+
// When
166+
var result = consortiaService.getAffiliatedTenants(currentTenantId, userId);
167+
// Then
168+
assertThat(result).isEmpty();
169+
verify(consortiumClient).getConsortia();
170+
verify(consortiumClient).getConsortiaUserTenants(consortiumId, userId, Integer.MAX_VALUE);
171+
}
174172

175-
@Test
176-
@TestMate(name = "TestMate-getAffiliatedTenantsShouldUseFirstConsortiumWhenMultipleExist")
173+
@Test
174+
@TestMate(name = "TestMate-9770ee36596ab839901934234deaaf48")
177175
void getAffiliatedTenantsShouldUseFirstConsortiumWhenMultipleExist() {
178-
// TestMate-9770ee36596ab839901934234deaaf48
179176
// Given
180177
var userId = "user-1";
181178
var currentTenantId = "tenant-1";

0 commit comments

Comments
 (0)