Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/Vas-11802: fix unit test failed on previous PR #1489

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@

@RunWith(SpringRunner.class)
@EnableMongoRepositories(
basePackageClasses = {ExternalParametersRepository.class, CustomSequenceRepository.class, GroupRepository.class,
OwnerRepository.class, ProfileRepository.class, UserRepository.class, TenantRepository.class },
repositoryBaseClass = VitamUIRepositoryImpl.class)
basePackageClasses = {ExternalParametersRepository.class, CustomSequenceRepository.class, GroupRepository.class,
OwnerRepository.class, ProfileRepository.class, UserRepository.class, TenantRepository.class},
repositoryBaseClass = VitamUIRepositoryImpl.class)
public class ExternalParametersInternalServiceTest extends AbstractLogbookIntegrationTest {

private ExternalParametersInternalService service;
public static final String ANY_EXTERNAL_PARAM_ID = "ANY_EXTERNAL_PARAM_ID";
private ExternalParametersInternalService service;

@MockBean
private ExternalParametersRepository externalParametersRepository;
Expand All @@ -66,18 +67,20 @@ public class ExternalParametersInternalServiceTest extends AbstractLogbookIntegr
@Before
public void setup() {
service = new ExternalParametersInternalService(
sequenceRepository, externalParametersRepository, externalParametersConverter, internalSecurityService,
sequenceRepository, externalParametersRepository, externalParametersConverter, internalSecurityService,
iamLogbookService);
}

@Test
public void testGetOne() {
final AuthUserDto user = IamServerUtilsTest.buildAuthUserDto();
user.getProfileGroup().getProfiles().get(0).setApplicationName(Application.EXTERNAL_PARAMS.toString());
user.getProfileGroup().getProfiles().get(0).setExternalParamId(ANY_EXTERNAL_PARAM_ID);
ExternalParameters externalParameters = new ExternalParameters();
externalParameters.setId(ID);

when(externalParametersRepository.findOne(ArgumentMatchers.any(Query.class))).thenReturn(Optional.of(externalParameters));
when(externalParametersRepository.findOne(ArgumentMatchers.any(Query.class))).thenReturn(
Optional.of(externalParameters));
when(internalSecurityService.getUser()).thenReturn(user);

ExternalParametersDto res = this.service.getMyExternalParameters();
Expand Down