Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport stable/1.2] Extend Either/EitherAssert capabilities #8815

Merged
7 commits merged into from
Feb 21, 2022

Conversation

npepinpe
Copy link
Member

Description

This PR backports #8797 to stable/1.2, which is necessary to in the end backport the fix for #5525. There were some conflicts which I corrected with the last commit (one extra dependency pulled).

Related issues

backports #8797

Definition of Done

Not all items need to be done depending on the issue and the pull request.

Code changes:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix to the last two minor versions. You can trigger a backport by assigning labels (e.g. backport stable/1.3) to the PR, in case that fails you need to create backports manually.

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually
  • The change has been verified by a QA run
  • The impact of the changes is verified by a benchmark

Documentation:

  • The documentation is updated (e.g. BPMN reference, configuration, examples, get-started guides, etc.)
  • New content is added to the release announcement
  • If the PR changes how BPMN processes are validated (e.g. support new BPMN element) then the Camunda modeling team should be informed to adjust the BPMN linting.

npepinpe and others added 6 commits February 18, 2022 17:19
Adds a `getOrElse` API to the `Either` type. This new method behaves
much like `Optional#getOrElse` by returning a default value when the
`Either` is a `Left`, or return its right value when it's a `Right`.

(cherry picked from commit 3dd05cf)
Extends the existing `EitherAssert` set of assertions with new
extraction capabilities. This allows one to write something like:

```java
EitherAssert.assertThat(either).left().isEqualTo(1);
EitherAssert.assertThat(instantEither)
	.right()
	.asInstanceOf(InstanceOfAssertFactories.INSTANT)
	.isBetween(today, tomorrow);
```

Assertion info is correctly preserved across the whole chain.

(cherry picked from commit 46c88e6)
Co-authored-by: Nico Korthout <korthout@users.noreply.github.com>
(cherry picked from commit 6347168)
Use the public `test-util` `EitherAssert` instead of the test scoped
`EitherAssert` found in the `util` module. We shouldn't use test scoped
files from other modules in general, and we should use the one made
explicitly for reuse.

(cherry picked from commit 7464426)
Removes the customized, generated `EitherAssert` in the util module. This was
only used for testing `Either` itself, but there was only marginal value
to it. Furthermore, we already have another `EitherAssert` available in
the `test-util` module, which is the one meant to be reused in all the
other modules as a test utility.

(cherry picked from commit e595174)
@npepinpe npepinpe force-pushed the backport-8797-to-stable/1.2 branch 2 times, most recently from cc40cbe to 998adf6 Compare February 18, 2022 18:20
Copy link
Member

@korthout korthout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @npepinpe LGTM 👍

@npepinpe
Copy link
Member Author

bors merge

@ghost ghost merged commit 6137e09 into stable/1.2 Feb 21, 2022
@ghost ghost deleted the backport-8797-to-stable/1.2 branch February 21, 2022 09:58
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants