Skip to content

Commit

Permalink
Access fields/methods more directly (hyperledger#4449)
Browse files Browse the repository at this point in the history
* Access fields/methods more directly

Signed-off-by: Justin Traglia <jtraglia@pm.me>

Signed-off-by: Justin Traglia <jtraglia@pm.me>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
  • Loading branch information
jtraglia and macfarla authored Oct 5, 2022
1 parent a80ed4e commit 9e267ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

import java.util.Collection;

import org.mockito.Mockito;

public class BftContextBuilder {

public static BftContext setupContextWithValidators(final Collection<Address> validators) {
Expand All @@ -37,7 +35,7 @@ public static BftContext setupContextWithValidators(final Collection<Address> va
when(bftContext.getValidatorProvider()).thenReturn(mockValidatorProvider);
when(mockValidatorProvider.getValidatorsAfterBlock(any())).thenReturn(validators);
when(bftContext.getBlockInterface()).thenReturn(mockBftBlockInterface);
when(bftContext.as(Mockito.any())).thenReturn(bftContext);
when(bftContext.as(any())).thenReturn(bftContext);
return bftContext;
}

Expand All @@ -59,7 +57,7 @@ public static <T extends BftContext> T setupContextWithBftExtraData(
when(mockValidatorProvider.getValidatorsAfterBlock(any())).thenReturn(validators);
when(bftContext.getBlockInterface()).thenReturn(mockBftBlockInterface);
when(mockBftBlockInterface.getExtraData(any())).thenReturn(bftExtraData);
when(bftContext.as(Mockito.any())).thenReturn(bftContext);
when(bftContext.as(any())).thenReturn(bftContext);
return bftContext;
}

Expand All @@ -78,7 +76,7 @@ public static <T extends BftContext> T setupContextWithBftExtraDataEncoder(
when(bftContext.getValidatorProvider()).thenReturn(mockValidatorProvider);
when(mockValidatorProvider.getValidatorsAfterBlock(any())).thenReturn(validators);
when(bftContext.getBlockInterface()).thenReturn(new BftBlockInterface(bftExtraDataCodec));
when(bftContext.as(Mockito.any())).thenReturn(bftContext);
when(bftContext.as(any())).thenReturn(bftContext);

return bftContext;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import java.util.stream.Collectors;

import org.apache.tuweni.bytes.Bytes;
import org.web3j.abi.DefaultFunctionReturnDecoder;
import org.web3j.abi.FunctionEncoder;
import org.web3j.abi.FunctionReturnDecoder;
import org.web3j.abi.TypeReference;
import org.web3j.abi.datatypes.DynamicArray;
import org.web3j.abi.datatypes.Function;
Expand Down Expand Up @@ -81,7 +81,7 @@ private List<Type> decodeResult(
final TransactionSimulatorResult result, final Function function) {
if (result.isSuccessful()) {
final List<Type> decodedList =
DefaultFunctionReturnDecoder.decode(
FunctionReturnDecoder.decode(
result.getResult().getOutput().toHexString(), function.getOutputParameters());

if (decodedList.isEmpty()) {
Expand Down

0 comments on commit 9e267ae

Please sign in to comment.