mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2025-09-08 17:59:43 +02:00
Version: Fix getSopJavaVersion()
This commit is contained in:
parent
48f71abaa5
commit
23a724ee0b
2 changed files with 8 additions and 2 deletions
|
@ -86,4 +86,10 @@ public class VersionTest extends AbstractSOPTest {
|
||||||
throw new TestAbortedException("Implementation does not provide coverage for any sopv interface version.");
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,12 +115,12 @@ interface Version {
|
||||||
fun getSopJavaVersion(): String? {
|
fun getSopJavaVersion(): String? {
|
||||||
return try {
|
return try {
|
||||||
val resourceIn: InputStream =
|
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.")
|
?: throw IOException("File sop-java-version.properties not found.")
|
||||||
val properties = Properties().apply { load(resourceIn) }
|
val properties = Properties().apply { load(resourceIn) }
|
||||||
properties.getProperty("sop-java-version")
|
properties.getProperty("sop-java-version")
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
null
|
"DEVELOPMENT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue