-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve JTSOp command - error handling, testing (#459)
* Improve JTSOpCmd to make it testable * Improve error handling * Update Travis CI with dist: trusty as per JDK8 failing advice Signed-off-by: Martin Davis <[email protected]>
- Loading branch information
Showing
5 changed files
with
304 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ cache: | |
directories: | ||
- $HOME/.m2 | ||
install: mvn install -B -V | ||
dist: trusty | ||
|
10 changes: 10 additions & 0 deletions
10
modules/app/src/main/java/org/locationtech/jtstest/cmd/CommandError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.locationtech.jtstest.cmd; | ||
|
||
public class CommandError extends RuntimeException { | ||
public CommandError(String msg) { | ||
super(msg); | ||
} | ||
public CommandError(String msg, String val) { | ||
super(msg + ": " + val); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
modules/app/src/main/java/org/locationtech/jtstest/cmd/CommandOutput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.locationtech.jtstest.cmd; | ||
|
||
public class CommandOutput { | ||
|
||
private StringBuilder output = new StringBuilder(); | ||
private boolean isCapture = false; | ||
|
||
public CommandOutput() { | ||
|
||
} | ||
|
||
public CommandOutput(boolean isCapture) { | ||
this.isCapture = true; | ||
} | ||
|
||
public void println() { | ||
if (isCapture ) { | ||
output.append("\n"); | ||
} | ||
else { | ||
System.out.println(); | ||
} | ||
} | ||
|
||
public void println(Object o) { | ||
if (isCapture ) { | ||
output.append(o); | ||
output.append("\n"); | ||
} | ||
else { | ||
System.out.println(o); | ||
} | ||
} | ||
|
||
public void print(String s) { | ||
if (isCapture ) { | ||
output.append(s); | ||
} | ||
else { | ||
System.out.print(s); | ||
} | ||
} | ||
|
||
public String getOutput() { | ||
return output.toString(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.