|
| 1 | +package mmcorej; |
| 2 | + |
| 3 | +import static org.junit.jupiter.api.Assertions.*; |
| 4 | + |
| 5 | +import java.io.InputStream; |
| 6 | +import java.util.Properties; |
| 7 | +import org.junit.jupiter.api.Test; |
| 8 | + |
| 9 | +class VersionConsistencyIT { |
| 10 | + |
| 11 | + @Test |
| 12 | + void pomVersionMatchesCMMCoreVersion() throws Exception { |
| 13 | + |
| 14 | + String path = "/META-INF/maven/org.micro-manager.mmcorej/MMCoreJ/pom.properties"; |
| 15 | + Properties props = new Properties(); |
| 16 | + try (InputStream is = getClass().getResourceAsStream(path)) { |
| 17 | + assertNotNull(is, "pom.properties not found at " + path); |
| 18 | + props.load(is); |
| 19 | + } |
| 20 | + |
| 21 | + String version = props.getProperty("version"); |
| 22 | + assertNotNull(version, "version property not found in pom.properties"); |
| 23 | + String[] parts = version.split("\\."); |
| 24 | + assertEquals(3, parts.length, |
| 25 | + "Expected version format major.minor.patch, got: " + version); |
| 26 | + |
| 27 | + int pomMajor = Integer.parseInt(parts[0]); |
| 28 | + int pomMinor = Integer.parseInt(parts[1]); |
| 29 | + int pomPatch = Integer.parseInt(parts[2]); |
| 30 | + |
| 31 | + assertEquals(pomMajor, CMMCore.getMMCoreVersionMajor(), |
| 32 | + "Major version mismatch between CMMCore and pom.xml"); |
| 33 | + assertEquals(pomMinor, CMMCore.getMMCoreVersionMinor(), |
| 34 | + "Minor version mismatch between CMMCore and pom.xml"); |
| 35 | + assertEquals(pomPatch, CMMCore.getMMCoreVersionPatch(), |
| 36 | + "Patch version mismatch between CMMCore and pom.xml"); |
| 37 | + } |
| 38 | +} |
0 commit comments