Formatted and cleaned some code
This commit is contained in:
parent
6fa132313d
commit
ce1547d71a
|
@ -22,35 +22,35 @@ public class RuntimeEnvironmentTester {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.indicatorSet = new HashSet<>();
|
||||
indicatorSet = new HashSet<>();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void assignInputName() {
|
||||
this.environment.setInputName("test");
|
||||
environment.setInputName("test");
|
||||
|
||||
assertEquals("test", this.environment.getInputName());
|
||||
assertEquals("test", environment.getInputName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void assignInput() {
|
||||
this.environment.setInput(System.in);
|
||||
environment.setInput(System.in);
|
||||
|
||||
assertEquals(System.in, this.environment.getInput());
|
||||
assertEquals(System.in, environment.getInput());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void assignOutput() {
|
||||
this.environment.setOutput(System.out);
|
||||
environment.setOutput(System.out);
|
||||
|
||||
assertEquals(System.out, this.environment.getOutput());
|
||||
assertEquals(System.out, environment.getOutput());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void assignErrorOutput() {
|
||||
this.environment.setErrorOutput(System.err);
|
||||
environment.setErrorOutput(System.err);
|
||||
|
||||
assertEquals(System.err, this.environment.getErrorOutput());
|
||||
assertEquals(System.err, environment.getErrorOutput());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -72,9 +72,9 @@ public class RuntimeEnvironmentTester {
|
|||
@Test
|
||||
public void assignErrorManager() {
|
||||
ErrorManager errorManager = new ErrorManager();
|
||||
this.environment.setErrorManager(errorManager);
|
||||
environment.setErrorManager(errorManager);
|
||||
|
||||
assertEquals(errorManager, this.environment.getErrorManager());
|
||||
assertEquals(errorManager, environment.getErrorManager());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,11 +19,16 @@ public class ErrorManagerTester {
|
|||
private Set<String> indicatorSet;
|
||||
private ByteArrayOutputStream errorOutputStream;
|
||||
private ByteArrayOutputStream outputStream;
|
||||
private RuntimeEnvironment environment;
|
||||
|
||||
public ErrorManagerTester() {
|
||||
this.environment = RuntimeEnvironment.getInstance();
|
||||
}
|
||||
|
||||
private ErrorManager createErrorManagerWithIndicators() {
|
||||
RuntimeEnvironment.getInstance().setErrorTerminationFunction(() -> indicatorSet.add(TERMINATED));
|
||||
RuntimeEnvironment.getInstance().setErrorOutput(new PrintStream(errorOutputStream));
|
||||
RuntimeEnvironment.getInstance().setOutput(new PrintStream(outputStream));
|
||||
environment.setErrorTerminationFunction(() -> indicatorSet.add(TERMINATED));
|
||||
environment.setErrorOutput(new PrintStream(errorOutputStream));
|
||||
environment.setOutput(new PrintStream(outputStream));
|
||||
|
||||
return new ErrorManager();
|
||||
}
|
||||
|
@ -71,9 +76,9 @@ public class ErrorManagerTester {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.indicatorSet = new HashSet<>();
|
||||
this.errorOutputStream = new ByteArrayOutputStream();
|
||||
this.outputStream = new ByteArrayOutputStream();
|
||||
indicatorSet = new HashSet<>();
|
||||
errorOutputStream = new ByteArrayOutputStream();
|
||||
outputStream = new ByteArrayOutputStream();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -16,6 +16,11 @@ public class LOADTester {
|
|||
|
||||
private ByteArrayOutputStream outputStream;
|
||||
private ByteArrayOutputStream errorOutputStream;
|
||||
private RuntimeEnvironment environment;
|
||||
|
||||
public LOADTester() {
|
||||
this.environment = RuntimeEnvironment.getInstance();
|
||||
}
|
||||
|
||||
private void assertWarningMessagePrinted() {
|
||||
assertTrue(outputStream.toByteArray().length > 0);
|
||||
|
@ -34,11 +39,12 @@ public class LOADTester {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.outputStream = new ByteArrayOutputStream();
|
||||
this.errorOutputStream = new ByteArrayOutputStream();
|
||||
RuntimeEnvironment.getInstance().setOutput(new PrintStream(outputStream));
|
||||
RuntimeEnvironment.getInstance().setErrorOutput(new PrintStream(errorOutputStream));
|
||||
RuntimeEnvironment.getInstance().setErrorManager(new ErrorManager());
|
||||
outputStream = new ByteArrayOutputStream();
|
||||
errorOutputStream = new ByteArrayOutputStream();
|
||||
|
||||
environment.setOutput(new PrintStream(outputStream));
|
||||
environment.setErrorOutput(new PrintStream(errorOutputStream));
|
||||
environment.setErrorManager(new ErrorManager());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -21,7 +21,7 @@ public class PRINTTester {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.outputStream = new ByteArrayOutputStream();
|
||||
outputStream = new ByteArrayOutputStream();
|
||||
RuntimeEnvironment.getInstance().setOutput(new PrintStream(outputStream));
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,11 @@ import table.FunctionTable;
|
|||
public class DEFUNTester {
|
||||
|
||||
private ByteArrayOutputStream outputStream;
|
||||
private RuntimeEnvironment environment;
|
||||
|
||||
public DEFUNTester() {
|
||||
this.environment = RuntimeEnvironment.getInstance();
|
||||
}
|
||||
|
||||
private void assertSomethingPrinted() {
|
||||
assertTrue(outputStream.toByteArray().length > 0);
|
||||
|
@ -22,9 +27,11 @@ public class DEFUNTester {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.outputStream = new ByteArrayOutputStream();
|
||||
RuntimeEnvironment.getInstance().setOutput(new PrintStream(outputStream));
|
||||
RuntimeEnvironment.getInstance().setErrorManager(new ErrorManager());
|
||||
outputStream = new ByteArrayOutputStream();
|
||||
|
||||
environment.setOutput(new PrintStream(outputStream));
|
||||
environment.setErrorManager(new ErrorManager());
|
||||
|
||||
FunctionTable.reset();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue