Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
Signed-off-by: gtebrean <[email protected]>
  • Loading branch information
gtebrean committed Aug 4, 2024
1 parent 6ab4169 commit ab5210c
Showing 1 changed file with 22 additions and 44 deletions.
66 changes: 22 additions & 44 deletions abi/src/test/java/org/web3j/abi/FunctionReturnDecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ public void testSimpleFunctionDecode() {
new Function(
"test",
Collections.<Type>emptyList(),
Collections.singletonList(new TypeReference<Uint>() {
}));
Collections.singletonList(new TypeReference<Uint>() {}));

assertEquals(
FunctionReturnDecoder.decode(
Expand All @@ -63,8 +62,7 @@ public void testSimpleFunctionStringResultDecode() {
new Function(
"simple",
Arrays.asList(),
Collections.singletonList(new TypeReference<Utf8String>() {
}));
Collections.singletonList(new TypeReference<Utf8String>() {}));

List<Type> utf8Strings =
FunctionReturnDecoder.decode(
Expand All @@ -82,8 +80,7 @@ public void testFunctionEmptyStringResultDecode() {
new Function(
"test",
Collections.emptyList(),
Collections.singletonList(new TypeReference<Utf8String>() {
}));
Collections.singletonList(new TypeReference<Utf8String>() {}));

List<Type> utf8Strings =
FunctionReturnDecoder.decode(
Expand All @@ -100,9 +97,7 @@ public void testMultipleResultFunctionDecode() {
new Function(
"test",
Collections.<Type>emptyList(),
Arrays.asList(new TypeReference<Uint>() {
}, new TypeReference<Uint>() {
}));
Arrays.asList(new TypeReference<Uint>() {}, new TypeReference<Uint>() {}));

assertEquals(
FunctionReturnDecoder.decode(
Expand All @@ -119,14 +114,10 @@ public void testDecodeMultipleStringValues() {
"function",
Collections.<Type>emptyList(),
Arrays.asList(
new TypeReference<Utf8String>() {
},
new TypeReference<Utf8String>() {
},
new TypeReference<Utf8String>() {
},
new TypeReference<Utf8String>() {
}));
new TypeReference<Utf8String>() {},
new TypeReference<Utf8String>() {},
new TypeReference<Utf8String>() {},
new TypeReference<Utf8String>() {}));

assertEquals(
FunctionReturnDecoder.decode(
Expand Down Expand Up @@ -154,10 +145,8 @@ public void testDecodeStaticArrayValue() {
List<TypeReference<Type>> outputParameters = new ArrayList<>(1);
outputParameters.add(
(TypeReference)
new TypeReference.StaticArrayTypeReference<StaticArray<Uint256>>(2) {
});
outputParameters.add((TypeReference) new TypeReference<Uint256>() {
});
new TypeReference.StaticArrayTypeReference<StaticArray<Uint256>>(2) {});
outputParameters.add((TypeReference) new TypeReference<Uint256>() {});

List<Type> decoded =
FunctionReturnDecoder.decode(
Expand Down Expand Up @@ -189,8 +178,7 @@ public void testEmptyResultFunctionDecode() {
new Function(
"test",
Collections.emptyList(),
Collections.singletonList(new TypeReference<Uint>() {
}));
Collections.singletonList(new TypeReference<Uint>() {}));

assertEquals(
FunctionReturnDecoder.decode("0x", function.getOutputParameters()),
Expand All @@ -203,8 +191,7 @@ public void testDecodeIndexedUint256Value() {
String encoded = TypeEncoder.encodeNumeric(value);

assertEquals(
FunctionReturnDecoder.decodeIndexedValue(encoded, new TypeReference<Uint256>() {
}),
FunctionReturnDecoder.decodeIndexedValue(encoded, new TypeReference<Uint256>() {}),
(value));
}

Expand All @@ -215,8 +202,7 @@ public void testDecodeIndexedStringValue() {
String hash = Hash.sha3(encoded);

assertEquals(
FunctionReturnDecoder.decodeIndexedValue(hash, new TypeReference<Utf8String>() {
}),
FunctionReturnDecoder.decodeIndexedValue(hash, new TypeReference<Utf8String>() {}),
(new Bytes32(Numeric.hexStringToByteArray(hash))));
}

Expand All @@ -226,8 +212,7 @@ public void testDecodeIndexedBytes32Value() {
byte[] rawInputBytes = Numeric.hexStringToByteArray(rawInput);

assertEquals(
FunctionReturnDecoder.decodeIndexedValue(rawInput, new TypeReference<Bytes32>() {
}),
FunctionReturnDecoder.decodeIndexedValue(rawInput, new TypeReference<Bytes32>() {}),
(new Bytes32(rawInputBytes)));
}

Expand All @@ -237,21 +222,19 @@ public void testDecodeIndexedBytes16Value() {
byte[] rawInputBytes = Numeric.hexStringToByteArray(rawInput.substring(0, 34));

assertEquals(
FunctionReturnDecoder.decodeIndexedValue(rawInput, new TypeReference<Bytes16>() {
}),
FunctionReturnDecoder.decodeIndexedValue(rawInput, new TypeReference<Bytes16>() {}),
(new Bytes16(rawInputBytes)));
}

@Test
public void testDecodeIndexedDynamicBytesValue() {
DynamicBytes bytes = new DynamicBytes(new byte[]{1, 2, 3, 4, 5});
DynamicBytes bytes = new DynamicBytes(new byte[] {1, 2, 3, 4, 5});
String encoded = TypeEncoder.encodeDynamicBytes(bytes);
String hash = Hash.sha3(encoded);

assertEquals(
FunctionReturnDecoder.decodeIndexedValue(
hash, new TypeReference<DynamicBytes>() {
}),
hash, new TypeReference<DynamicBytes>() {}),
(new Bytes32(Numeric.hexStringToByteArray(hash))));
}

Expand All @@ -265,8 +248,7 @@ public void testDecodeIndexedDynamicArrayValue() {

assertEquals(
FunctionReturnDecoder.decodeIndexedValue(
hash, new TypeReference<DynamicArray>() {
}),
hash, new TypeReference<DynamicArray>() {}),
(new Bytes32(Numeric.hexStringToByteArray(hash))));
}

Expand Down Expand Up @@ -1281,10 +1263,8 @@ public void testDecodeTupleOfStaticArrays() {
List outputParameters = new ArrayList<TypeReference<Type>>();
outputParameters.addAll(
Arrays.asList(
new TypeReference<StaticArray4<Utf8String>>() {
},
new TypeReference<StaticArray4<Uint256>>() {
}));
new TypeReference<StaticArray4<Utf8String>>() {},
new TypeReference<StaticArray4<Uint256>>() {}));

// tuple of (strings string[4]{"", "", "", ""}, ints int[4]{0, 0, 0, 0})
String rawInput =
Expand Down Expand Up @@ -1355,12 +1335,10 @@ public void testDynamicStructFix() throws ClassNotFoundException {
MyStructTypes.add(TypeReference.makeTypeReference("uint256"));
MyStructTypes.add(TypeReference.makeTypeReference("string"));
MyStructTypes.add(TypeReference.makeTypeReference("string"));
MyStructTypes.add(new TypeReference<DynamicStruct>(false, MyStruct2Types) {
});
MyStructTypes.add(new TypeReference<DynamicStruct>(false, MyStruct2Types) {});

MyParameters.add(TypeReference.makeTypeReference("string"));
MyParameters.add(new TypeReference<DynamicStruct>(false, MyStructTypes) {
});
MyParameters.add(new TypeReference<DynamicStruct>(false, MyStructTypes) {});

MyParameters.add(TypeReference.makeTypeReference("string"));

Expand Down

0 comments on commit ab5210c

Please sign in to comment.