-
-
Notifications
You must be signed in to change notification settings - Fork 765
Open
💥 Breaking
Copy link
Labels
theme: genericsAn issue related to Java generic typesAn issue related to Java generic types
Milestone
Description
Feature summary
So, I'm noticing that my attempts to validate that this toString() and getVersion are returning the same thing is kind of painful.
Example
// using semver4j, note this won't pass because my code subclasses and stuff even then, but compiling
var v010 = Semver.coerce("v0.1.0");
// asserthat(v010).matchesToString(...) nope doesn't exist
assertThat(v010)
.extracting(Semver::getVersion, Semver::toString)
.allSatisfy(o -> {
assertThat(o).isInstanceOf(String.class); // I guess chaining off this assertion won't convince allowance of matches
if (o instanceof String s) { // but couldn't o already have determined we're a string?
assertThat(s).matches("^0\\.1\\.0-SNAPSHOT-1-g\\p{XDigit}{7}$");
}
});Metadata
Metadata
Assignees
Labels
theme: genericsAn issue related to Java generic typesAn issue related to Java generic types