Skip to content

Commit 99d7334

Browse files
committed
Additional updates for JDK 1.6 compliance.
1 parent eeed679 commit 99d7334

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

src/test/java/org/web3j/abi/FunctionReturnDecoderTest.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.web3j.utils.Numeric;
1919

2020
import static org.hamcrest.CoreMatchers.is;
21+
import static org.hamcrest.core.IsEqual.equalTo;
2122
import static org.junit.Assert.assertThat;
2223

2324
public class FunctionReturnDecoderTest {
@@ -89,7 +90,7 @@ public void testMultipleResultFunctionDecode() {
8990
public void testDecodeMultipleStringValues() {
9091
Function function = new Function("function",
9192
Collections.<Type>emptyList(),
92-
Arrays.asList(
93+
Arrays.<TypeReference<?>>asList(
9394
new TypeReference<Utf8String>() { }, new TypeReference<Utf8String>() { },
9495
new TypeReference<Utf8String>() { }, new TypeReference<Utf8String>() { }));
9596

@@ -107,15 +108,17 @@ public void testDecodeMultipleStringValues() {
107108
"0000000000000000000000000000000000000000000000000000000000000004" +
108109
"6d6e6f3200000000000000000000000000000000000000000000000000000000",
109110
function.getOutputParameters()),
110-
equalTo(Arrays.asList(
111+
equalTo(Arrays.<Type>asList(
111112
new Utf8String("def1"), new Utf8String("ghi1"),
112113
new Utf8String("jkl1"), new Utf8String("mno2"))));
113114
}
114115

115116

117+
118+
116119
@Test
117120
public void testDecodeStaticArrayValue() {
118-
List<TypeReference<Type>> outputParameters = new ArrayList<>(1);
121+
List<TypeReference<Type>> outputParameters = new ArrayList<TypeReference<Type>>(1);
119122
outputParameters.add((TypeReference)
120123
new TypeReference.StaticArrayTypeReference<StaticArray<Uint256>>(2) {});
121124
outputParameters.add((TypeReference) new TypeReference<Uint256>() {});
@@ -127,10 +130,12 @@ public void testDecodeStaticArrayValue() {
127130
"000000000000000000000000000000000000000000000000000000000000000a",
128131
outputParameters);
129132

130-
List<Type> expected = Arrays.asList(
131-
new StaticArray<>(new Uint256(BigInteger.valueOf(55)), new Uint256(BigInteger.ONE)),
133+
List<Type> expected = Arrays.<Type>asList(
134+
new StaticArray<Uint256>(new Uint256(BigInteger.valueOf(55)), new Uint256(BigInteger.ONE)),
132135
new Uint256(BigInteger.TEN));
133-
assertThat(decoded, equalTo(expected));
136+
137+
138+
assertThat(decoded, is(expected));
134139
}
135140

136141
@Test

src/test/java/org/web3j/utils/AsyncTest.java

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.web3j.utils;
22

33

4+
import java.util.concurrent.Callable;
45
import java.util.concurrent.ExecutionException;
56

67
import org.junit.Test;
@@ -13,13 +14,21 @@ public class AsyncTest {
1314

1415
@Test
1516
public void testRun() throws Exception {
16-
assertThat(Async.run(() -> "").get(), is(""));
17+
assertThat(Async.run(new Callable<String>() {
18+
@Override
19+
public String call() throws Exception {
20+
return "";
21+
}
22+
}).get(), is(""));
1723
}
1824

1925
@Test(expected = ExecutionException.class)
2026
public void testRunException() throws Exception {
21-
Async.run(() -> {
22-
throw new RuntimeException("");
27+
Async.run(new Callable<String>() {
28+
@Override
29+
public String call() throws Exception {
30+
throw new RuntimeException();
31+
}
2332
}).get();
2433
}
2534
}

0 commit comments

Comments
 (0)