Skip to content

Commit

Permalink
test: improve assertj usage (#20)
Browse files Browse the repository at this point in the history
recommendtion from assertj/assertj#3372
  • Loading branch information
xenoterracide committed Feb 27, 2024
1 parent 8b06250 commit f7d5f27
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 f7d5f27

Please sign in to comment.