Skip to content

Commit

Permalink
test: improve assertj usage
Browse files Browse the repository at this point in the history
recommendtion from assertj/assertj#3372
  • Loading branch information
xenoterracide committed Feb 23, 2024
1 parent a9d2fc1 commit 5703f1c
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -8,6 +8,7 @@
import java.io.File;
import java.util.Collections;
import java.util.List;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.eclipse.jgit.annotations.NonNull;
import org.eclipse.jgit.api.Git;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -41,10 +42,9 @@ void getVersion() throws Exception {
assertThat(v010)
.extracting(Semver::getVersion, Semver::toString)
.allSatisfy(o -> {
assertThat(o).isInstanceOf(String.class);
if (o instanceof String s) {
assertThat(s).matches("^0\\.1\\.0-SNAPSHOT-1-g\\p{XDigit}{7}$");
}
assertThat(o)
.asInstanceOf(InstanceOfAssertFactories.STRING)
.matches("^0\\.1\\.0-SNAPSHOT-1-g\\p{XDigit}{7}$");
});

git.tag().setName("v0.1.1").call();
Expand Down

0 comments on commit 5703f1c

Please sign in to comment.