Skip to content

Commit cce9d74

Browse files
committed
Address deprecation warnings in tests
1 parent af47c7d commit cce9d74

File tree

8 files changed

+20
-19
lines changed

8 files changed

+20
-19
lines changed

src/test/java/com/laytonsmith/PureUtilities/ClassLoading/GeneralTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
import org.junit.BeforeClass;
1818
import org.junit.Test;
1919
import static org.hamcrest.CoreMatchers.is;
20+
import static org.hamcrest.MatcherAssert.assertThat;
2021
import static org.junit.Assert.assertTrue;
2122
import static org.junit.Assert.assertEquals;
2223
import static org.junit.Assert.assertFalse;
23-
import static org.junit.Assert.assertThat;
2424

2525
/**
2626
*

src/test/java/com/laytonsmith/PureUtilities/Common/TimeConversionUtilTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
package com.laytonsmith.PureUtilities.Common;
77

88
import org.junit.Test;
9-
import static org.junit.Assert.*;
109
import static org.hamcrest.core.Is.is;
10+
import static org.hamcrest.MatcherAssert.assertThat;
1111

1212
/**
1313
*

src/test/java/com/laytonsmith/PureUtilities/ConcurrentSingletonHashMapTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
import java.util.Map;
99
import java.util.concurrent.atomic.AtomicInteger;
1010
import static org.hamcrest.core.Is.is;
11+
import static org.hamcrest.MatcherAssert.assertThat;
1112
import org.junit.Test;
1213
import static org.junit.Assert.assertTrue;
1314
import static org.junit.Assert.assertFalse;
14-
import static org.junit.Assert.assertThat;
1515
import org.junit.Before;
1616

1717
/**

src/test/java/com/laytonsmith/PureUtilities/JSONUtilTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.HashMap;
1010
import java.util.Map;
1111
import org.hamcrest.core.Is;
12+
import org.hamcrest.MatcherAssert;
1213
import org.junit.Assert;
1314
import static org.junit.Assert.assertTrue;
1415
import static org.junit.Assert.assertArrayEquals;
@@ -197,7 +198,7 @@ public void testSerialize() throws Exception {
197198
d.s.b = true;
198199
d.s.i = 5;
199200
String s = jd.serialize(d);
200-
Assert.assertThat(s, Is.is("{\"s\":{\"b\":true,\"i\":5},\"m\":\"string\"}"));
201+
MatcherAssert.assertThat(s, Is.is("{\"s\":{\"b\":true,\"i\":5},\"m\":\"string\"}"));
201202
}
202203

203204
@Test
@@ -207,7 +208,7 @@ public void testSerializeArray() throws Exception {
207208
a.I = new Integer[]{};
208209
a.s = new String[]{"s", "t", "r"};
209210
String s = jd.serialize(a);
210-
Assert.assertThat(s, Is.is("{\"s\":[\"s\",\"t\",\"r\"],\"i\":[1,2,3],\"I\":[]}"));
211+
MatcherAssert.assertThat(s, Is.is("{\"s\":[\"s\",\"t\",\"r\"],\"i\":[1,2,3],\"I\":[]}"));
211212
}
212213

213214
static enum EnumTest {
@@ -232,7 +233,7 @@ public void testEnumSerialization() throws Exception {
232233
c.id = 45;
233234
c.enumValue = EnumTest.ONE;
234235
String s = jd.serialize(c);
235-
Assert.assertThat(s, Is.is("{\"enumValue\":1,\"id\":45}"));
236+
MatcherAssert.assertThat(s, Is.is("{\"enumValue\":1,\"id\":45}"));
236237
}
237238

238239
static enum EnumTest2 implements JSONUtil.CustomLongEnum<EnumTest2> {
@@ -280,7 +281,7 @@ public void testEnumSerializationCustom() throws Exception {
280281
c.id = 45;
281282
c.et = EnumTest2.FIRST;
282283
String s = jd.serialize(c);
283-
Assert.assertThat(s, Is.is("{\"id\":45,\"et\":100}"));
284+
MatcherAssert.assertThat(s, Is.is("{\"id\":45,\"et\":100}"));
284285
}
285286

286287
static class MapContainer {
@@ -295,14 +296,14 @@ public void testMapSerialization() throws Exception {
295296
mc.map.put("one", "one");
296297
mc.map.put("two", "two");
297298
String s = jd.serialize(mc);
298-
Assert.assertThat(s, Is.is("{\"map\":{\"two\":\"two\",\"one\":\"one\"}}"));
299+
MatcherAssert.assertThat(s, Is.is("{\"map\":{\"two\":\"two\",\"one\":\"one\"}}"));
299300
}
300301

301302
@Test
302303
public void testMapDeserialization() throws Exception {
303304
MapContainer mc = jd.deserialize("{\"map\":{\"two\":\"two\",\"one\":\"one\"}}", MapContainer.class);
304305
Assert.assertNotNull(mc.map);
305-
Assert.assertThat(mc.map.get("one"), Is.is("one"));
306-
Assert.assertThat(mc.map.get("two"), Is.is("two"));
306+
MatcherAssert.assertThat(mc.map.get("one"), Is.is("one"));
307+
MatcherAssert.assertThat(mc.map.get("two"), Is.is("two"));
307308
}
308309
}

src/test/java/com/laytonsmith/core/TestStatic.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ public void testGetInt() {
7272

7373
@Test
7474
public void testGetBoolean() {
75-
assertEquals(true, ArgumentValidation.getBoolean(C.Boolean(true), Target.UNKNOWN));
76-
assertEquals(true, ArgumentValidation.getBoolean(C.String("non-empty string"), Target.UNKNOWN));
77-
assertEquals(false, ArgumentValidation.getBoolean(C.String(""), Target.UNKNOWN));
78-
assertEquals(true, ArgumentValidation.getBoolean(C.Int(1), Target.UNKNOWN));
79-
assertEquals(false, ArgumentValidation.getBoolean(C.Int(0), Target.UNKNOWN));
75+
assertTrue(ArgumentValidation.getBooleanish(C.Boolean(true), Target.UNKNOWN));
76+
assertTrue(ArgumentValidation.getBooleanish(C.String("non-empty string"), Target.UNKNOWN));
77+
assertFalse(ArgumentValidation.getBooleanish(C.String(""), Target.UNKNOWN));
78+
assertTrue(ArgumentValidation.getBooleanish(C.Int(1), Target.UNKNOWN));
79+
assertFalse(ArgumentValidation.getBooleanish(C.Int(0), Target.UNKNOWN));
8080
}
8181

8282
@Test

src/test/java/com/laytonsmith/core/functions/ArrayHandlingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static com.laytonsmith.testing.StaticTest.TestClassDocs;
2020
import static com.laytonsmith.testing.StaticTest.assertCEquals;
2121
import static com.laytonsmith.testing.StaticTest.assertReturn;
22+
import static org.hamcrest.MatcherAssert.assertThat;
2223
import static org.junit.Assert.assertEquals;
2324
import org.junit.Before;
2425
import org.junit.Test;
@@ -27,7 +28,6 @@
2728
import static org.mockito.Mockito.times;
2829
import static org.mockito.Mockito.verify;
2930
import static org.hamcrest.core.Is.*;
30-
import static org.junit.Assert.*;
3131

3232
/**
3333
*

src/test/java/com/laytonsmith/core/functions/DataTransformationsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
import com.laytonsmith.testing.StaticTest;
1111
import static com.laytonsmith.testing.StaticTest.SRun;
1212
import static org.hamcrest.CoreMatchers.is;
13+
import static org.hamcrest.MatcherAssert.assertThat;
1314
import org.junit.After;
1415
import org.junit.AfterClass;
15-
import static org.junit.Assert.assertThat;
1616
import org.junit.Before;
1717
import org.junit.BeforeClass;
1818
import org.junit.Test;

src/test/java/com/laytonsmith/testing/StaticTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ public static void assertCNotEquals(Mixed expected, Mixed actual) throws CancelC
386386
* @param actual
387387
*/
388388
public static void assertCTrue(Mixed actual) {
389-
if(!ArgumentValidation.getBoolean(actual, Target.UNKNOWN)) {
389+
if(!ArgumentValidation.getBooleanish(actual, Target.UNKNOWN)) {
390390
fail("Expected '" + actual.val() + "' to resolve to true, but it did not");
391391
}
392392
}
@@ -398,7 +398,7 @@ public static void assertCTrue(Mixed actual) {
398398
* @param actual
399399
*/
400400
public static void assertCFalse(Mixed actual) {
401-
if(ArgumentValidation.getBoolean(actual, Target.UNKNOWN)) {
401+
if(ArgumentValidation.getBooleanish(actual, Target.UNKNOWN)) {
402402
fail("Expected '" + actual.val() + "' to resolve to false, but it did not");
403403
}
404404
}

0 commit comments

Comments
 (0)