Skip to content

Commit

Permalink
Fix issue with parent (extends) inside another dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
boretti committed May 15, 2020
1 parent 9b8d9fc commit f5cb0d0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
Expand Up @@ -30,6 +30,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Supplier;

Expand Down Expand Up @@ -110,7 +111,7 @@ public String generateMainJavaDoc() {
}

public Collection<DSLMethod> generateDSLStarter() {
return dslProvider.stream().map(Supplier::get).collect(toList());
return dslProvider.stream().map(Supplier::get).filter(Objects::nonNull).collect(toList());
}

public String getDefaultStarterBody(boolean withParentBuilder) {
Expand Down Expand Up @@ -196,10 +197,10 @@ public ProvidesMatchersAnnotatedElementMirror getParentMirror() {
}

public DSLMethod generateParentValueDSLStarter() {
ProvidesMatchersAnnotatedElementMirror parentMirror = getParentMirror();
String argumentForParentBuilder = parentMirror.getFullyQualifiedNameOfGeneratedClass() + "."
+ parentMirror.methodShortClassName + "WithSameValue(other)";
return generatParentValueDSLStarter(argumentForParentBuilder);
return Optional.ofNullable(getParentMirror())
.map(parentMirror -> generatParentValueDSLStarter(parentMirror.getFullyQualifiedNameOfGeneratedClass()
+ "." + parentMirror.methodShortClassName + "WithSameValue(other)"))
.orElse(null);
}

public DSLMethod generateParentInSameRoundWithChaningDSLStarter() {
Expand Down
@@ -0,0 +1,27 @@
package ch.powerunit.extensions.matchers.samples.extension;

import org.apache.commons.lang3.tuple.Pair;

import ch.powerunit.extensions.matchers.ProvideMatchers;

@ProvideMatchers
public class MyPair<L,R> extends Pair<L, R> {

public String test;

@Override
public R setValue(R arg0) {
return null;
}

@Override
public L getLeft() {
return null;
}

@Override
public R getRight() {
return null;
}

}

0 comments on commit f5cb0d0

Please sign in to comment.