hasXXX assertions generate invalid code when XXX is an Iterable of an interface type.
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 42/100
Research direction
Start at org.assertj.assertions.generator.util.ClassUtil#getTypeDeclaration and compare its handling of captured class and interface bounds. Reproduce the generated AbstractBlahAssert for a List; done means hasSequences uses valid Java without the "interface" keyword.
Written by the indexing model from the issue text.
Description
Given a class:
public class Blah {
private List<CharSequence> sequences;
public List<CharSequence> getSequences() { return sequences; }
}
the AbstractBlahAssert is generated with code such as:
public S hasSequences(interface java.lang.CharSequence... sequences) { ... }
(note the "interface" keyword in there.)
This is the result of org.assertj.assertions.generator.util.ClassUtil#getTypeDeclaration correctly handling situations where the contained type is a class:
String name = typeVariable.getName(); // capture#1-of ? extends class java.lang.String
name = removeAll(name, "capture#\\d+-of\\s+"); // extends class java.lang.String
name = removeAll(name, " class"); // extends java.lang.String
typeDeclaration.append(name); // List<? extends java.lang.String>
But not when it's an interface:
String name = typeVariable.getName(); // capture#1-of ? extends interface java.lang.CharSequence
name = removeAll(name, "capture#\\d+-of\\s+"); // extends interface java.lang.CharSequence
name = removeAll(name, " class"); // extends interface java.lang.CharSequence
typeDeclaration.append(name); // List<? extends interface java.lang.CharSequence>
- Dominant language
- Java
- Stars
- 72
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from assertj/assertj-generator
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
assertj/assertj-generator#278 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
assertj/assertj-generator#220 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
assertj/assertj-generator#219 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
assertj/assertj-generator#204 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
assertj/assertj-generator#197 · 7 comments ·
All issues in assertj/assertj-generator
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100