assertj / assertj/assertj-generator

Support Java 8 Optional Feature

Open
#51 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
72
Forks
47
Avg merge
1d 16h
Merged PRs (30d)
2

Description

Is it possible to support Java 8 Optional feature for the generator?

Sample model class:

``` java
public class Person {

private String name;

public Person(String name) {
this.name = name;
}

public Optional getName() {
return name == null ? Optional.empty() : Optional.of(name);
}
}
```

Generated assertion class:

``` java
public class PersonAssert extends AbstractAssert {

public PersonAssert hasName(java.util.Optional name) {
}
}
```

Suggested assert class:

``` java
public class PersonAssert extends AbstractAssert {

// Generator might lookup generic type of the Optional and generate the method without Optional parameter
public PersonAssert hasName(String name) {
}

public PersonAssert hasName(java.util.Optional name) {
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.