mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#2907 Add test case for nested import of array
This commit is contained in:
parent
383ed23ed2
commit
1c3c46f1ef
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 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._2907;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||||
|
import org.mapstruct.ap.test.bugs._2907.mapper.Issue2907Mapper;
|
||||||
|
import org.mapstruct.ap.testutil.IssueKey;
|
||||||
|
import org.mapstruct.ap.testutil.ProcessorTest;
|
||||||
|
import org.mapstruct.ap.testutil.WithClasses;
|
||||||
|
import org.mapstruct.ap.testutil.runner.GeneratedSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Filip Hrisafov
|
||||||
|
*/
|
||||||
|
@IssueKey("2907")
|
||||||
|
@WithClasses({
|
||||||
|
Issue2907Mapper.class,
|
||||||
|
Source.class,
|
||||||
|
SourceNested.class,
|
||||||
|
Target.class,
|
||||||
|
})
|
||||||
|
class Issue2907Test {
|
||||||
|
|
||||||
|
@RegisterExtension
|
||||||
|
final GeneratedSource generatedSource = new GeneratedSource();
|
||||||
|
|
||||||
|
@ProcessorTest
|
||||||
|
void shouldNotGeneratedImportForNestedClass() {
|
||||||
|
generatedSource.forMapper( Issue2907Mapper.class )
|
||||||
|
.containsNoImportFor( Target.TargetNested.class );
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* 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._2907;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class Source {
|
||||||
|
|
||||||
|
private Set<SourceNested> nested;
|
||||||
|
|
||||||
|
public Set<SourceNested> getNested() {
|
||||||
|
return nested;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNested(Set<SourceNested> nested) {
|
||||||
|
this.nested = nested;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* 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._2907;
|
||||||
|
|
||||||
|
public class SourceNested {
|
||||||
|
|
||||||
|
private String prop;
|
||||||
|
|
||||||
|
public String getProp() {
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProp(String prop) {
|
||||||
|
this.prop = prop;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* 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._2907;
|
||||||
|
|
||||||
|
public class Target {
|
||||||
|
|
||||||
|
private TargetNested[] nested;
|
||||||
|
|
||||||
|
public TargetNested[] getNested() {
|
||||||
|
return nested;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNested(TargetNested[] nested) {
|
||||||
|
this.nested = nested;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TargetNested {
|
||||||
|
private String prop;
|
||||||
|
|
||||||
|
public String getProp() {
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProp(String prop) {
|
||||||
|
this.prop = prop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* 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._2907.mapper;
|
||||||
|
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.ap.test.bugs._2907.Source;
|
||||||
|
import org.mapstruct.ap.test.bugs._2907.Target;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface Issue2907Mapper {
|
||||||
|
|
||||||
|
Target map(Source source);
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user