#2117 Add extra test case

This commit is contained in:
Filip Hrisafov 2020-06-21 23:47:02 +02:00
parent bdc58b9602
commit 92b4316abd
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,30 @@
/*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.ap.test.bugs._2117;
import java.nio.file.AccessMode;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
/**
* @author Filip Hrisafov
*/
@Mapper
public interface Issue2117Mapper {
Issue2117Mapper INSTANCE = Mappers.getMapper( Issue2117Mapper.class );
@Mapping(target = "accessMode", source = "accessMode")
Target toTarget(AccessMode accessMode, String otherSource);
class Target {
// CHECKSTYLE:OFF
public AccessMode accessMode;
// CHECKSTYLE ON
}
}

View File

@ -0,0 +1,36 @@
/*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.ap.test.bugs._2117;
import java.nio.file.AccessMode;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mapstruct.ap.testutil.IssueKey;
import org.mapstruct.ap.testutil.WithClasses;
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Filip Hrisafov
*/
@IssueKey("2117")
@RunWith(AnnotationProcessorTestRunner.class)
@WithClasses({
Issue2117Mapper.class
})
public class Issue2117Test {
@Test
public void shouldCompile() {
Issue2117Mapper.Target target = Issue2117Mapper.INSTANCE.toTarget( AccessMode.READ, null );
assertThat( target ).isNotNull();
assertThat( target.accessMode ).isEqualTo( AccessMode.READ );
}
}