Skip to content

Commit

Permalink
Applied feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrouR committed Dec 4, 2019
1 parent a13452c commit d6f90ba
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static Optional<String> setGeneratedTestLocation() {
static boolean userWantsTests() {
print("Would you like to generate unit test for your solidity contracts [Y/n] ? ");
String userAnswer = getUserInput();
return userAnswer.toLowerCase().equals("y");
return userAnswer.trim().toLowerCase().equals("y") || userAnswer.trim().equals("");
}

static String getSolidityProjectPath() {
Expand All @@ -93,7 +93,7 @@ private static void print(final String text) {
}

static boolean overrideExistingProject() {
print("Looks like the project exists. Would you like to override it [Y/n] ?");
print("Looks like the project exists. Would you like to override it [y/N] ?");
String userAnswer = getUserInput();
return userAnswer.toLowerCase().equals("y");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ void generate(boolean withTests) {
generateTests();
onSuccess();
} catch (final Exception e) {
e.printStackTrace();
exitError(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ProjectImporterCLIRunner extends ProjectCreatorCLIRunner {
String solidityImportPath;

@Option(
names = {"-t", "--generate-unit-tests"},
names = {"-t", "--generate-tests"},
description = "Generate unit tests for the contract wrappers",
required = false,
showDefaultValue = ALWAYS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
import org.web3j.codegen.Console;

@CommandLine.Command(
name = "generate",
name = "generate-tests",
mixinStandardHelpOptions = true,
version = "4.0",
sortOptions = false)
public class UnitTestCLIRunner implements Runnable {
@CommandLine.Option(
names = {"-i", "--java-wrapper-directory"},
description = "the class path of your generated wrapper",
description = "The class path of your generated wrapper.",
required = true)
String javaWrapperDir;

@CommandLine.Option(
names = {"-o", "--output-directory"},
description = "the path where the unit tests will be generated",
description = "The path where the unit tests will be generated.",
required = true)
String unitTestOutputDir;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import static org.web3j.utils.Collection.tail;

public class UnitTestCreator {
public static final String COMMAND_GENERATE_TESTS = "generateTests";
public static final String COMMAND_GENERATE_TESTS = "generate-tests";

private final String writePath;
private final String wrapperPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ public static String capitalizeFirstLetter(String input) {
}

public static boolean projectExists(File projectDir) {
if (projectDir.exists()) {
return true;
}
return false;
return projectDir.exists();
}
}
2 changes: 1 addition & 1 deletion src/main/resources/build.gradle.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
group 'test'
version '0.1.0'

sourceCompatibility = 1.8
sourceCompatibility = 11

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
*/
package org.web3j.console.project;

import java.io.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
import java.io.PrintStream;
import java.nio.file.Path;

import org.junit.jupiter.api.BeforeEach;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
import org.web3j.console.project.utills.ClassExecutor;

import static java.io.File.separator;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class ProjectCreatorTest extends ClassExecutor {
private ByteArrayOutputStream outContent = new ByteArrayOutputStream();
Expand Down

0 comments on commit d6f90ba

Please sign in to comment.