Skip to content

Commit d46f2ef

Browse files
committed
creating new feature branch for 2.0 with JUnit 5
1 parent 47a4e45 commit d46f2ef

File tree

20 files changed

+594
-665
lines changed

20 files changed

+594
-665
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pipeline {
6767
}
6868
}
6969
steps {
70-
sh 'mvn -P system-test -Dmw_home=${ORACLE_HOME} test-compile failsafe:integration-test'
70+
sh 'mvn -DskipITs=false -Dmw_home=${ORACLE_HOME} verify'
7171
}
7272
post {
7373
always {

core/pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@
3737
<dependency>
3838
<groupId>org.python</groupId>
3939
<artifactId>jython</artifactId>
40-
<version>2.2.1</version>
4140
<scope>provided</scope>
4241
</dependency>
4342
<dependency>
44-
<groupId>junit</groupId>
45-
<artifactId>junit</artifactId>
43+
<groupId>org.junit.jupiter</groupId>
44+
<artifactId>junit-jupiter-engine</artifactId>
4645
<scope>test</scope>
4746
</dependency>
4847
<dependency>

core/src/test/java/oracle/weblogic/deploy/aliases/TypeUtilsTest.java

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,53 +11,54 @@
1111
import java.util.Map;
1212
import java.util.Properties;
1313

14-
import org.junit.Test;
14+
import org.junit.jupiter.api.Test;
1515
import org.python.core.PyDictionary;
1616
import org.python.core.PyLong;
1717
import org.python.core.PyObject;
1818
import org.python.core.PyString;
1919
import org.python.core.PyTuple;
2020

21-
import static org.junit.Assert.*;
21+
import static org.junit.jupiter.api.Assertions.assertEquals;
22+
import static org.junit.jupiter.api.Assertions.assertNull;
23+
import static org.junit.jupiter.api.Assertions.assertThrows;
24+
import static org.powermock.utils.Asserts.assertNotNull;
2225

2326
public class TypeUtilsTest {
2427
@Test
2528
public void convertToType() throws Exception {
26-
assertEquals("Integer conversion failed", 123, TypeUtils.convertToType("integer", "123"));
27-
assertEquals("Long conversion failed", 123L, TypeUtils.convertToType( "long", "123"));
28-
assertEquals("Double conversion failed", 123.45D, TypeUtils.convertToType( "double", "123.45"));
29-
assertEquals("Boolean conversion failed", "true", TypeUtils.convertToType( "boolean", "true"));
30-
assertEquals("Boolean conversion failed", "false", TypeUtils.convertToType( "boolean", 0));
29+
assertEquals(123, TypeUtils.convertToType("integer", "123"), "Integer conversion failed");
30+
assertEquals(123L, TypeUtils.convertToType( "long", "123"), "Long conversion failed");
31+
assertEquals(123.45D, TypeUtils.convertToType( "double", "123.45"), "Double conversion failed");
32+
assertEquals("true", TypeUtils.convertToType( "boolean", "true"), "Boolean conversion failed");
33+
assertEquals("false", TypeUtils.convertToType( "boolean", 0), "Boolean conversion failed");
3134

32-
assertEquals("String conversion failed", "222", TypeUtils.convertToType( "string", 222));
33-
assertEquals("Password conversion failed", "abcdef", TypeUtils.convertToType( "password", "abcdef"));
34-
assertEquals("String conversion failed", "222", TypeUtils.convertToType( "string", "222".toCharArray()));
35+
assertEquals("222", TypeUtils.convertToType( "string", 222), "String conversion failed");
36+
assertEquals("abcdef", TypeUtils.convertToType( "password", "abcdef"), "Password conversion failed");
37+
assertEquals("222", TypeUtils.convertToType( "string", "222".toCharArray()), "String conversion failed");
3538

3639
String[] strings = {"one", "two", "three"};
37-
assertEquals("List conversion failed",
38-
Arrays.asList(strings),
39-
TypeUtils.convertToType( "list", "one, two, three"));
40+
assertEquals(Arrays.asList(strings), TypeUtils.convertToType( "list", "one, two, three"), "List conversion failed");
4041
}
4142

42-
@Test(expected = AliasException.class)
43-
public void convertToTypeInvalidStringType() throws Exception {
44-
TypeUtils.convertToType( "fancy", "123" );
43+
@Test
44+
public void convertToTypeInvalidStringType() {
45+
assertThrows(AliasException.class, () -> TypeUtils.convertToType("fancy", "123"));
4546
}
4647

47-
@Test(expected = AliasException.class)
48-
public void convertToTypeInvalidPrimitiveType() throws Exception {
49-
TypeUtils.convertToType( int.class, "123" );
48+
@Test
49+
public void convertToTypeInvalidPrimitiveType() {
50+
assertThrows(AliasException.class, () -> TypeUtils.convertToType(int.class, "123"));
5051
}
5152

52-
@Test(expected = AliasException.class)
53-
public void convertInvalidInteger() throws Exception {
54-
TypeUtils.convertToType(Integer.class, "this is a string");
53+
@Test
54+
public void convertInvalidInteger() {
55+
assertThrows(AliasException.class, () -> TypeUtils.convertToType(Integer.class, "this is a string"));
5556
}
5657

5758
@Test
5859
public void convertToTypeNullTest() throws Exception {
59-
assertEquals("String null conversion failed", null, TypeUtils.convertToType( String.class, null ));;
60-
assertEquals("Character null conversion failed", null, TypeUtils.convertToType( Character.class, "" ));;
60+
assertNull(TypeUtils.convertToType(String.class, null), "String null conversion failed");
61+
assertNull(TypeUtils.convertToType(Character.class, ""), "Character null conversion failed");
6162
}
6263

6364
@Test
@@ -95,10 +96,10 @@ public void convertStringToMap() throws Exception {
9596
expected.put("key2", "value2");
9697
expected.put("key3", "value3");
9798
expected.put("key4", "value4");
98-
assertEquals("String to Map conversion failed", expected, TypeUtils.convertStringToMap(str, ","));
99-
assertEquals("JSON to Map conversion failed", expected, TypeUtils.convertStringToMap(json, ","));
100-
assertEquals("String to Map conversion failed", expected, TypeUtils.convertToType(Map.class, str, ","));
101-
assertEquals("Map to Map conversion failed", expected, TypeUtils.convertToType(Map.class, expected));
99+
assertEquals(expected, TypeUtils.convertStringToMap(str, ","), "String to Map conversion failed");
100+
assertEquals(expected, TypeUtils.convertStringToMap(json, ","), "JSON to Map conversion failed");
101+
assertEquals(expected, TypeUtils.convertToType(Map.class, str, ","), "String to Map conversion failed");
102+
assertEquals(expected, TypeUtils.convertToType(Map.class, expected), "Map to Map conversion failed");
102103
}
103104

104105
@Test
@@ -108,21 +109,20 @@ public void convertListToArray() throws Exception {
108109
list.add("two");
109110
list.add("three");
110111
Object result = TypeUtils.convertToType(String[].class, list);
111-
if ( result == null )
112-
fail("convertToType returned null for List conversion to String[]");
113-
assertEquals("List conversion failed", String[].class, result.getClass());
112+
assertNotNull(result, "convertToType returned null for List conversion to String[]");
113+
assertEquals(String[].class, result.getClass(), "List conversion failed");
114114

115115
}
116116

117117
@Test
118118
public void convertToList() throws Exception {
119119
String[] array = { "one", "two", "three" };
120120
List<String> expected = Arrays.asList(array);
121-
assertEquals("List from array conversion failed", expected, TypeUtils.convertToType(List.class, array));
121+
assertEquals(expected, TypeUtils.convertToType(List.class, array), "List from array conversion failed");
122122
String str = "one, two, three";
123-
assertEquals("List from string conversion failed", expected, TypeUtils.convertToType(List.class, str));
123+
assertEquals(expected, TypeUtils.convertToType(List.class, str), "List from string conversion failed");
124124
String[] empty = {};
125-
assertEquals("List from empty list conversion failed", null, TypeUtils.convertToType(List.class, empty));
125+
assertNull(TypeUtils.convertToType(List.class, empty), "List from empty list conversion failed");
126126
}
127127

128128
@Test
@@ -132,12 +132,12 @@ public void convertToProperties() throws Exception {
132132
Properties expected = new Properties();
133133
expected.put("key1", "value1");
134134
expected.put("key2", "value2");
135-
assertEquals("Properties from String failed", expected, TypeUtils.convertToType(Properties.class, str, ";"));
135+
assertEquals(expected, TypeUtils.convertToType(Properties.class, str, ";"), "Properties from String failed");
136136

137137
Map<String, String> map = new HashMap<>();
138138
map.put("key1", "value1");
139139
map.put("key2", "value2");
140-
assertEquals("Properties from Map failed", expected, TypeUtils.convertToType(Properties.class, map, ";"));
140+
assertEquals(expected, TypeUtils.convertToType(Properties.class, map, ";"), "Properties from Map failed");
141141

142142
}
143143

@@ -154,6 +154,6 @@ public void convertDictToProperties() throws Exception {
154154
expected.put("mail.smtp.port", "25");
155155
expected.put("mail.smtp.host", "192.168.56.1");
156156

157-
assertEquals("Properties from dict failed", expected, result);
157+
assertEquals(expected, result, "Properties from dict failed");
158158
}
159159
}

0 commit comments

Comments
 (0)