Skip to content

Commit 5ecd722

Browse files
committedMay 14, 2019
Added Junit framework and basic test
1 parent 2a4d61f commit 5ecd722

File tree

4 files changed

+59
-8
lines changed

4 files changed

+59
-8
lines changed
 

Diff for: ‎Jenkinsfile

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
pipeline {
22
agent any
3+
tools {
4+
maven 'maven-3.6.0'
5+
jdk 'jdk11'
6+
}
37

48
stages {
5-
stage('Build') {
9+
stage ('Environment') {
610
steps {
7-
echo 'Building..'
11+
sh '''
12+
echo "PATH = ${PATH}"
13+
echo "M2_HOME = ${M2_HOME}"
14+
mvn --version
15+
'''
816
}
917
}
10-
stage('Test') {
18+
stage ('Build') {
1119
steps {
12-
echo 'Testing..'
20+
sh 'mvn -B clean package'
1321
}
1422
}
15-
stage('Deploy') {
23+
stage ('Test') {
1624
steps {
17-
echo 'Deploying....'
25+
sh 'mvn test'
26+
}
27+
post {
28+
always {
29+
junit 'target/surefire-reports/*.xml'
30+
}
1831
}
1932
}
2033
}

Diff for: ‎pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
<artifactId>json</artifactId>
3939
<version>20180813</version>
4040
</dependency>
41+
<dependency>
42+
<groupId>junit</groupId>
43+
<artifactId>junit</artifactId>
44+
<version>4.12</version>
45+
<scope>test</scope>
46+
</dependency>
4147
</dependencies>
4248

4349
<build>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.oracle.weblogic.imagetool.api.model;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.assertEquals;
6+
7+
public class DomainTypeTest {
8+
9+
@org.junit.Test
10+
public void fromValue() {
11+
assertEquals("validate domain type lowercase jrf", DomainType.JRF, DomainType.fromValue("jrf"));
12+
assertEquals("validate domain type uppercase jrf", DomainType.JRF, DomainType.fromValue("JRF"));
13+
assertEquals("validate domain type lowercase wls", DomainType.WLS, DomainType.fromValue("wls"));
14+
assertEquals("validate domain type uppercase WLS", DomainType.WLS, DomainType.fromValue("WLS"));
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
/* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
2-
*
32
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
43
*/
54
package com.oracle.weblogic.imagetool.util;
65

6+
import org.junit.Test;
7+
8+
import static org.junit.Assert.assertEquals;
9+
import static org.junit.Assert.assertTrue;
10+
711
public class UtilsTest {
8-
}
12+
13+
@Test
14+
public void compareVersions() {
15+
assertEquals(0, Utils.compareVersions("12.2.1.3.0", "12.2.1.3.0"));
16+
assertTrue(Utils.compareVersions("1.0", "1.1") < 0);
17+
assertTrue(Utils.compareVersions("1.1", "1.0") > 0);
18+
}
19+
20+
@Test
21+
public void isEmptyString() {
22+
assertTrue(Utils.isEmptyString(""));
23+
}
24+
}

0 commit comments

Comments
 (0)