use of io.gravitee.repository.management.api.InstallationRepository in project gravitee-management-rest-api by gravitee-io.
the class InstallationServiceTest method shouldUpdateAdditionalInformation.
@Test
public void shouldUpdateAdditionalInformation() throws TechnicalException {
Map<String, String> newAdditionalInformation = new HashMap<>();
newAdditionalInformation.put("key1", "value1");
Installation updatedInstallation = new Installation(installation);
updatedInstallation.setAdditionalInformation(newAdditionalInformation);
updatedInstallation.setUpdatedAt(new Date());
when(installationRepository.update(any(Installation.class))).thenReturn(updatedInstallation);
final InstallationEntity updatedInstallationEntity = installationService.setAdditionalInformation(newAdditionalInformation);
verify(installationRepository).find();
verify(installationRepository).update(ArgumentMatchers.argThat(argument -> argument != null && INSTALLATION_ID.equals(argument.getId()) && NOW.equals(argument.getCreatedAt()) && NOW.before(argument.getUpdatedAt()) && newAdditionalInformation.equals(argument.getAdditionalInformation())));
assertNotNull(updatedInstallationEntity);
assertEquals(INSTALLATION_ID, updatedInstallationEntity.getId());
assertEquals(NOW, updatedInstallationEntity.getCreatedAt());
assertEquals(1, updatedInstallationEntity.getAdditionalInformation().size());
assertEquals("value1", updatedInstallationEntity.getAdditionalInformation().get("key1"));
}
Aggregations