Skip to content

Commit

Permalink
Appeasing the coverage police
Browse files Browse the repository at this point in the history
  • Loading branch information
eepstein committed Nov 9, 2017
1 parent d46a77b commit 03c7bb2
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ private void generate() throws IOException, ClassNotFoundException {
}
new SolidityFunctionWrapper(useJavaNativeTypes)
.generateJavaFiles(contractName,
c.bytecode,
c.abi,
c.getBytecode(),
c.getAbi(),
destinationDirLocation.toString(),
basePackageName,
addresses);
Expand Down Expand Up @@ -226,72 +226,7 @@ public Contract(String contractName, List<AbiDefinition> abi, String bytecode,
this.schemaVersion = schemaVersion;
this.updatedAt = updatedAt;
}

public Contract withContractName(String contractName) {
this.contractName = contractName;
return this;
}

public Contract withAbi(List<AbiDefinition> abi) {
this.abi = abi;
return this;
}

public Contract withBytecode(String bytecode) {
this.bytecode = bytecode;
return this;
}

public Contract withDeployedBytecode(String deployedBytecode) {
this.deployedBytecode = deployedBytecode;
return this;
}

public Contract withSourceMap(String sourceMap) {
this.sourceMap = sourceMap;
return this;
}

public Contract withDeployedSourceMap(String deployedSourceMap) {
this.deployedSourceMap = deployedSourceMap;
return this;
}

public Contract withSource(String source) {
this.source = source;
return this;
}

public Contract withSourcePath(String sourcePath) {
this.sourcePath = sourcePath;
return this;
}

public Contract withAst(JsonNode ast) {
this.ast = ast;
return this;
}

public Contract withCompiler(Compiler compiler) {
this.compiler = compiler;
return this;
}

public Contract withNetworks(Map<String, NetworkInfo> networks) {
this.networks = networks;
return this;
}

public Contract withSchemaVersion(String schemaVersion) {
this.schemaVersion = schemaVersion;
return this;
}

public Contract withUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
return this;
}


public String getContractName() {
return contractName;
}
Expand All @@ -303,47 +238,7 @@ public List<AbiDefinition> getAbi() {
public String getBytecode() {
return bytecode;
}

public String getDeployedBytecode() {
return deployedBytecode;
}

public String getSourceMap() {
return sourceMap;
}

public String getDeployedSourceMap() {
return deployedSourceMap;
}

public String getSource() {
return source;
}

public String getSourcePath() {
return sourcePath;
}

public JsonNode getAst() {
return ast;
}

public Compiler getCompiler() {
return compiler;
}

public Map<String, NetworkInfo> getNetworks() {
return networks;
}

public String getSchemaVersion() {
return schemaVersion;
}

public Date getUpdatedAt() {
return updatedAt;
}


public NetworkInfo getNetwork(String networkId) {
return networks.get(networkId);
}
Expand Down Expand Up @@ -404,16 +299,6 @@ public Compiler(String name, String version) {
this.version = version;
}

public Compiler withName(String name) {
this.name = name;
return this;
}

public Compiler withVersion(String version) {
this.version = version;
return this;
}

@JsonAnyGetter
public Map<String, JsonNode> getAdditionalProperties() {
return this.additionalProperties;
Expand Down Expand Up @@ -462,12 +347,7 @@ public NetworkInfo(Map<String, JsonNode> events, Map<String, JsonNode> links,
this.links = links;
this.address = address;
}

public NetworkInfo withAddress(String address) {
this.address = address;
return this;
}


public String getAddress() {
return address;
}
Expand Down
7 changes: 7 additions & 0 deletions core/src/test/java/org/web3j/tx/ContractTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.web3j.utils.Async;
import org.web3j.utils.Numeric;

import static junit.framework.TestCase.assertNotNull;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -254,6 +255,12 @@ public void testInvalidTransactionResponse() throws Throwable {
testErrorScenario();
}

@Test
public void testSetGetAddresses() throws Exception {
assertNull(contract.getDeployedAddress("1"));
contract.setDeployedAddress("1", "0x000000000000add0e00000000000");
assertNotNull(contract.getDeployedAddress("1"));
}

@Test(expected = RuntimeException.class)
public void testInvalidTransactionReceipt() throws Throwable {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Nov 06 17:09:51 GMT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip
26 changes: 17 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

##############################################################################
##
Expand Down Expand Up @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand Down Expand Up @@ -154,11 +154,19 @@ if $cygwin ; then
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
6 changes: 0 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ goto fail
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
Expand All @@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
Expand Down
14 changes: 13 additions & 1 deletion utils/src/test/java/org/web3j/utils/StringsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.web3j.utils.Strings.capitaliseFirstLetter;
import static org.web3j.utils.Strings.isEmpty;
import static org.web3j.utils.Strings.join;
import static org.web3j.utils.Strings.lowercaseFirstLetter;
import static org.web3j.utils.Strings.repeat;
Expand All @@ -19,7 +22,7 @@ public class StringsTest {

@Test
public void testToCsv() {
assertThat(toCsv(Collections.<String>emptyList()), is(""));
assertThat(toCsv(Collections.emptyList()), is(""));
assertThat(toCsv(Collections.singletonList("a")), is("a"));
assertThat(toCsv(Arrays.asList("a", "b", "c")), is("a, b, c"));
}
Expand Down Expand Up @@ -58,4 +61,13 @@ public void testZeros() {
assertThat(zeros(0), is(""));
assertThat(zeros(3), is("000"));
}

@SuppressWarnings("ConstantConditions")
@Test
public void testEmptyString() {
assertTrue(isEmpty(null));
assertTrue(isEmpty(""));
assertFalse(isEmpty("hello world"));
}

}

0 comments on commit 03c7bb2

Please sign in to comment.