Java Code Examples for org.mapstruct.factory.Mappers

The following examples show how to use org.mapstruct.factory.Mappers. These examples are extracted from open source projects. 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 Project: XS2A-Sandbox   Source File: TppAdminControllerTest.java    License: 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 Project: XS2A-Sandbox   Source File: ConsentServiceTest.java    License: 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 Project: ariADDna   Source File: AccessTokenServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
public AccessTokenServiceImpl() {
    transformer = Mappers.getMapper(AccessTokenTransformer.class);
}
 
Example 4
Source Project: ariADDna   Source File: CertificateServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
public CertificateServiceImpl() {
    tranformer = Mappers.getMapper(CertificateTransformer.class);
}
 
Example 5
Source Project: ariADDna   Source File: KeyStorePasswordServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
public KeyStorePasswordServiceImpl() {
    transformer = Mappers.getMapper(KeyStorePasswordTransformer.class);
}
 
Example 6
Source Project: ariADDna   Source File: CloudCredentialsServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
public CloudCredentialsServiceImpl() {
    transformer = Mappers.getMapper(CloudCredentialsTransformer.class);
}