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