BAEL-3765: Code Upload (#8804)
This commit is contained in:
parent
7a2c941024
commit
40a17f0f63
|
@ -0,0 +1,20 @@
|
|||
package com.baeldung.version;
|
||||
|
||||
import org.springframework.boot.system.JavaVersion;
|
||||
import org.springframework.boot.system.SystemProperties;
|
||||
import org.springframework.core.SpringVersion;
|
||||
|
||||
public class VersionObtainer {
|
||||
|
||||
public String getSpringVersion() {
|
||||
return SpringVersion.getVersion();
|
||||
}
|
||||
|
||||
public String getJavaVersion() {
|
||||
return JavaVersion.getJavaVersion().toString();
|
||||
}
|
||||
|
||||
public String getJdkVersion() {
|
||||
return SystemProperties.get("java.version");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.baeldung.version;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest(classes = VersionObtainer.class)
|
||||
public class VersionObtainerUnitTest {
|
||||
|
||||
public VersionObtainer version = new VersionObtainer();
|
||||
|
||||
@Test
|
||||
public void testGetSpringVersion() {
|
||||
String res = version.getSpringVersion();
|
||||
assertThat(res).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetJdkVersion() {
|
||||
String res = version.getJdkVersion();
|
||||
assertThat(res).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetJavaVersion() {
|
||||
String res = version.getJavaVersion();
|
||||
assertThat(res).isNotEmpty();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue