fixed some more tests

This commit is contained in:
JonathanFleischmann 2024-07-03 22:50:32 +02:00
parent 82f62667ec
commit 04a84806b1
5 changed files with 0 additions and 50 deletions

View File

@ -15,11 +15,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
*/ */
public class CallVariableOutsideScope { public class CallVariableOutsideScope {
@BeforeEach
public void dontPrintAnything() {
System.setOut(null);
}
// Having a variable declared inside an Else-block and trying to call it outside the block. // Having a variable declared inside an Else-block and trying to call it outside the block.
@Test @Test
public void CallVariableOutsideScopeOfElse() { public void CallVariableOutsideScopeOfElse() {
@ -55,9 +50,4 @@ public class CallVariableOutsideScope {
public void CallVariableOutsideScopeOfWhile() { public void CallVariableOutsideScopeOfWhile() {
assertThrows(Exception.class, () -> Compiler.generateByteCodeArrayFromFiles(List.of("src/test/testFiles/Negative/CallVariableOutsideScope/OfWhile.java"))); assertThrows(Exception.class, () -> Compiler.generateByteCodeArrayFromFiles(List.of("src/test/testFiles/Negative/CallVariableOutsideScope/OfWhile.java")));
} }
@AfterEach
public void printNormal() {
System.setOut(System.out);
}
} }

View File

@ -15,11 +15,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
*/ */
public class ForbiddenParticularitiesInImplementation { public class ForbiddenParticularitiesInImplementation {
@BeforeEach
public void dontPrintAnything() {
System.setOut(null);
}
// Using any access modifier other than public // Using any access modifier other than public
@Test @Test
public void ForbiddenParticularitiesInImplementationAccessModifier() { public void ForbiddenParticularitiesInImplementationAccessModifier() {
@ -75,9 +70,4 @@ public class ForbiddenParticularitiesInImplementation {
"src/test/testFiles/Negative/ForbiddenParticularitiesInImplementation/" + "src/test/testFiles/Negative/ForbiddenParticularitiesInImplementation/" +
"UsingSystemOut.java"))); "UsingSystemOut.java")));
} }
@AfterEach
public void printNormal() {
System.setOut(System.out);
}
} }

View File

@ -16,11 +16,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
*/ */
public class MissingComponents { public class MissingComponents {
@BeforeEach
public void dontPrintAnything() {
System.setOut(null);
}
@Test @Test
public void MissingComponentsBraceInClass() { public void MissingComponentsBraceInClass() {
assertThrows(Exception.class, () -> { assertThrows(Exception.class, () -> {
@ -308,9 +303,4 @@ public class MissingComponents {
"src/test/testFiles/Negative/MissingComponents/Return.java")); "src/test/testFiles/Negative/MissingComponents/Return.java"));
}); });
} }
@AfterEach
public void printNormal() {
System.setOut(System.out);
}
} }

View File

@ -11,11 +11,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
public class UsingSameName { public class UsingSameName {
@BeforeEach
public void dontPrintAnything() {
System.setOut(null);
}
@Test @Test
public void UsingSameNameForParameterAndVariable() { public void UsingSameNameForParameterAndVariable() {
assertThrows(Exception.class, () -> Compiler.generateByteCodeArrayFromFiles(List.of( assertThrows(Exception.class, () -> Compiler.generateByteCodeArrayFromFiles(List.of(
@ -33,9 +28,4 @@ public class UsingSameName {
assertThrows(Exception.class, () -> Compiler.generateByteCodeArrayFromFiles(List.of( assertThrows(Exception.class, () -> Compiler.generateByteCodeArrayFromFiles(List.of(
"src/test/testFiles/Negative/UsingSameName/ForTwoVariables.java"))); "src/test/testFiles/Negative/UsingSameName/ForTwoVariables.java")));
} }
@AfterEach
public void printNormal() {
System.setOut(System.out);
}
} }

View File

@ -11,11 +11,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
public class WrongType { public class WrongType {
@BeforeEach
public void dontPrintAnything() {
System.setOut(null);
}
@Test @Test
public void WrongTypeCheckTypeDifferencesBetweenBoolAndChar() { public void WrongTypeCheckTypeDifferencesBetweenBoolAndChar() {
assertThrows(Exception.class, () -> Compiler.generateByteCodeArrayFromFiles(List.of( assertThrows(Exception.class, () -> Compiler.generateByteCodeArrayFromFiles(List.of(
@ -304,9 +299,4 @@ public class WrongType {
assertThrows(Exception.class, () -> Compiler.generateByteCodeArrayFromFiles(List.of( assertThrows(Exception.class, () -> Compiler.generateByteCodeArrayFromFiles(List.of(
"src/test/testFiles/Negative/WrongType/InReturnStatementWithinVoidMethod.java"))); "src/test/testFiles/Negative/WrongType/InReturnStatementWithinVoidMethod.java")));
} }
@AfterEach
public void printNormal() {
System.setOut(System.out);
}
} }