Skip to content

Commit

Permalink
change to void on isValid EthAddressValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
casiojapi committed Jul 27, 2023
1 parent b60e510 commit 8a6f9fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public final class EthAddressValidator {
private static final int ETH_ADDRESS_BYTE_LENGTH = 20;
private EthAddressValidator() { }

public static boolean isValid(String parameter){
public static void isValid(String parameter){
byte[] addressBytes = null;

try {
Expand All @@ -37,7 +37,5 @@ public static boolean isValid(String parameter){
if (ETH_ADDRESS_BYTE_LENGTH != addressBytes.length ) {
throw RskJsonRpcRequestException.invalidParamError("Invalid address: incorrect length.");
}

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
import org.ethereum.rpc.exception.RskJsonRpcRequestException;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;

class EthAddressValidatorTest {
@Test
void testValidAddress() {
assertTrue(EthAddressValidator.isValid("0x023827714750bf8c232ed8856049dc6dd42a693c"));
assertTrue(EthAddressValidator.isValid("0x023827714750bf8c232ed8856049dc6dd42a693"));
assertDoesNotThrow(() -> EthAddressValidator.isValid("0x023827714750bf8c232ed8856049dc6dd42a693c"));
assertDoesNotThrow(() -> EthAddressValidator.isValid("0x023827714750bf8c232ed8856049dc6dd42a693"));
}

@Test
Expand Down

0 comments on commit 8a6f9fb

Please sign in to comment.