Version: Fix getSopJavaVersion()

This commit is contained in:
Paul Schaub 2025-06-17 12:12:23 +02:00
parent 01be696f75
commit 04d154f63d
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 8 additions and 2 deletions

View file

@ -86,4 +86,10 @@ public class VersionTest extends AbstractSOPTest {
throw new TestAbortedException("Implementation does not provide coverage for any sopv interface version.");
}
}
@ParameterizedTest
@MethodSource("provideInstances")
public void sopJavaVersionTest(SOP sop) {
assertNotNull(sop.version().getSopJavaVersion());
}
}

View file

@ -115,12 +115,12 @@ interface Version {
fun getSopJavaVersion(): String? {
return try {
val resourceIn: InputStream =
javaClass.getResourceAsStream("/sop-java-version.properties")
Version::class.java.getResourceAsStream("/sop-java-version.properties")
?: throw IOException("File sop-java-version.properties not found.")
val properties = Properties().apply { load(resourceIn) }
properties.getProperty("sop-java-version")
} catch (e: IOException) {
null
"DEVELOPMENT"
}
}
}