org.mapstruct.factory.Mappers Java Examples

The following examples show how to use org.mapstruct.factory.Mappers. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TppAdminControllerTest.java    From XS2A-Sandbox with Apache License 2.0 5 votes vote down vote up
@Test
void register() {
    when(adminRestClient.register(any())).thenReturn(ResponseEntity.created(URI.create("")).build());
    when(userMapper.toUserTO(any())).thenAnswer(a -> Mappers.getMapper(UserMapper.class).toUserTO(a.getArgument(0)));
    User request = new User();
    request.setUserRoles(Collections.singletonList(UserRole.CUSTOMER));
    ResponseEntity<Void> result = controller.register(request, "TPP");
    assertEquals(HttpStatus.CREATED, result.getStatusCode());
}
 
Example #2
Source File: ConsentServiceTest.java    From XS2A-Sandbox with Apache License 2.0 5 votes vote down vote up
@Test
void createPiisConsent() throws JsonProcessingException, NoSuchFieldException {
    // Given
    FieldSetter.setField(consentService, consentService.getClass().getDeclaredField("createPiisConsentRequestMapper"), Mappers.getMapper(CreatePiisConsentRequestMapper.class));

    when(cmsAspspPiisClient.createConsent(any(), anyString(), nullable(String.class), nullable(String.class), nullable(String.class))).thenReturn(getCreatePiisConsentResponse());
    when(consentRestClient.grantPIISConsent(any())).thenReturn(ResponseEntity.ok(getSCAConsentResponseTO()));
    when(consentDataClient.updateAspspConsentData(anyString(), any())).thenReturn(ResponseEntity.ok().build());
    when(objectMapper.writeValueAsBytes(any())).thenReturn(getByteArray());

    consentService.createPiisConsent(getCreatePiisConsentRequest(), "psiId");

    verify(objectMapper, times(1)).writeValueAsBytes(getSCAConsentResponseTO());
}
 
Example #3
Source File: AccessTokenServiceImpl.java    From ariADDna with Apache License 2.0 4 votes vote down vote up
public AccessTokenServiceImpl() {
    transformer = Mappers.getMapper(AccessTokenTransformer.class);
}
 
Example #4
Source File: CertificateServiceImpl.java    From ariADDna with Apache License 2.0 4 votes vote down vote up
public CertificateServiceImpl() {
    tranformer = Mappers.getMapper(CertificateTransformer.class);
}
 
Example #5
Source File: KeyStorePasswordServiceImpl.java    From ariADDna with Apache License 2.0 4 votes vote down vote up
public KeyStorePasswordServiceImpl() {
    transformer = Mappers.getMapper(KeyStorePasswordTransformer.class);
}
 
Example #6
Source File: CloudCredentialsServiceImpl.java    From ariADDna with Apache License 2.0 4 votes vote down vote up
public CloudCredentialsServiceImpl() {
    transformer = Mappers.getMapper(CloudCredentialsTransformer.class);
}