Cleaned up some code
This commit is contained in:
parent
e51d275b76
commit
49e145d098
|
@ -21,7 +21,7 @@ public class LispInterpreter {
|
|||
this.errorManager = this.environment.getErrorManager();
|
||||
this.output = environment.getOutput();
|
||||
}
|
||||
|
||||
|
||||
public void setInput(InputStream input, String inputName) {
|
||||
environment.setInput(input);
|
||||
environment.setInputName(inputName);
|
||||
|
|
|
@ -29,8 +29,8 @@ public interface LispInterpreterBuilder {
|
|||
|
||||
void setCriticalOutputDecorator(Function<String, String> criticalOutputDecorator);
|
||||
|
||||
default void reset() {}
|
||||
|
||||
LispInterpreter build();
|
||||
|
||||
default void reset() {}
|
||||
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ public class LispInterpreterBuilderImpl implements LispInterpreterBuilder {
|
|||
private LispInterpreter createInterpreter() {
|
||||
return isInteractive ? new InteractiveLispInterpreter() : new LispInterpreter();
|
||||
}
|
||||
|
||||
|
||||
public static class InterpreterAlreadyBuiltException extends CriticalLispException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -67,12 +67,22 @@ public class LispInterpreterBuilderTester {
|
|||
builder.build();
|
||||
builder.build();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void interpreterAlreadyBuiltException_HasMessage() {
|
||||
InterpreterAlreadyBuiltException e = new InterpreterAlreadyBuiltException();
|
||||
|
||||
assertNotNull(e.getMessage());
|
||||
assertTrue(e.getMessage().length() > 0);
|
||||
InterpreterAlreadyBuiltException e = new InterpreterAlreadyBuiltException();
|
||||
|
||||
assertNotNull(e.getMessage());
|
||||
assertTrue(e.getMessage().length() > 0);
|
||||
}
|
||||
|
||||
@Test(expected = InterpreterAlreadyBuiltException.class)
|
||||
public void resetNormallyDoesNothing() {
|
||||
builder = new LispInterpreterBuilderImpl();
|
||||
|
||||
builder.build();
|
||||
builder.reset();
|
||||
builder.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package main;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
|
||||
public class MainTester {
|
||||
|
||||
@Before
|
||||
|
@ -13,9 +10,4 @@ public class MainTester {
|
|||
@After
|
||||
public void tearDown() throws Exception {}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue