Cleaned up some code

This commit is contained in:
Mike Cifelli 2017-02-26 12:39:08 -05:00
parent e51d275b76
commit 49e145d098
5 changed files with 19 additions and 17 deletions

View File

@ -21,7 +21,7 @@ public class LispInterpreter {
this.errorManager = this.environment.getErrorManager(); this.errorManager = this.environment.getErrorManager();
this.output = environment.getOutput(); this.output = environment.getOutput();
} }
public void setInput(InputStream input, String inputName) { public void setInput(InputStream input, String inputName) {
environment.setInput(input); environment.setInput(input);
environment.setInputName(inputName); environment.setInputName(inputName);

View File

@ -29,8 +29,8 @@ public interface LispInterpreterBuilder {
void setCriticalOutputDecorator(Function<String, String> criticalOutputDecorator); void setCriticalOutputDecorator(Function<String, String> criticalOutputDecorator);
default void reset() {}
LispInterpreter build(); LispInterpreter build();
default void reset() {}
} }

View File

@ -158,7 +158,7 @@ public class LispInterpreterBuilderImpl implements LispInterpreterBuilder {
private LispInterpreter createInterpreter() { private LispInterpreter createInterpreter() {
return isInteractive ? new InteractiveLispInterpreter() : new LispInterpreter(); return isInteractive ? new InteractiveLispInterpreter() : new LispInterpreter();
} }
public static class InterpreterAlreadyBuiltException extends CriticalLispException { public static class InterpreterAlreadyBuiltException extends CriticalLispException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -67,12 +67,22 @@ public class LispInterpreterBuilderTester {
builder.build(); builder.build();
builder.build(); builder.build();
} }
@Test
public void interpreterAlreadyBuiltException_HasMessage() { public void interpreterAlreadyBuiltException_HasMessage() {
InterpreterAlreadyBuiltException e = new InterpreterAlreadyBuiltException(); InterpreterAlreadyBuiltException e = new InterpreterAlreadyBuiltException();
assertNotNull(e.getMessage()); assertNotNull(e.getMessage());
assertTrue(e.getMessage().length() > 0); assertTrue(e.getMessage().length() > 0);
}
@Test(expected = InterpreterAlreadyBuiltException.class)
public void resetNormallyDoesNothing() {
builder = new LispInterpreterBuilderImpl();
builder.build();
builder.reset();
builder.build();
} }
} }

View File

@ -1,10 +1,7 @@
package main; package main;
import static org.junit.Assert.*;
import org.junit.*; import org.junit.*;
public class MainTester { public class MainTester {
@Before @Before
@ -13,9 +10,4 @@ public class MainTester {
@After @After
public void tearDown() throws Exception {} public void tearDown() throws Exception {}
@Test
public void test() {
fail("Not yet implemented");
}
} }