assertj / assertj/assertj-generator

Rename parameter to avoid name clashing

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

Description

If a class has an `actual` field/property, it clashes with the generated assertion `actual` parameter.

In this example, the `actual` parameter clashes with actual object under test in `actual.getActual();`
```java
public S hasActual(boolean actual) {
// check that actual Group we want to make assertions on is not null.
isNotNull();

// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting actual of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";

// check
boolean actualActual = actual.getActual();
if (actualActual != actual) {
failWithMessage(assertjErrorMessage, actual, actual, actualActual);
}

// return the current assertion for method chaining
return myself;
}

```

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.