[JAVA-16711] Remove unnecessary system out logging
This commit is contained in:
parent
85fded9b10
commit
e367437bb7
|
@ -8,4 +8,5 @@ This module contains articles about core java exceptions
|
||||||
- [Convert long to int Type in Java](https://www.baeldung.com/java-convert-long-to-int)
|
- [Convert long to int Type in Java](https://www.baeldung.com/java-convert-long-to-int)
|
||||||
- [“Sneaky Throws” in Java](https://www.baeldung.com/java-sneaky-throws)
|
- [“Sneaky Throws” in Java](https://www.baeldung.com/java-sneaky-throws)
|
||||||
- [Get the Current Stack Trace in Java](https://www.baeldung.com/java-get-current-stack-trace)
|
- [Get the Current Stack Trace in Java](https://www.baeldung.com/java-get-current-stack-trace)
|
||||||
|
- [Errors and Exceptions in Java](https://www.baeldung.com/java-errors-vs-exceptions)
|
||||||
- [[<-- Prev]](../core-java-exceptions-3)
|
- [[<-- Prev]](../core-java-exceptions-3)
|
||||||
|
|
|
@ -3,12 +3,7 @@ package com.baeldung.exception.exceptions_vs_errors;
|
||||||
public class ErrorExample {
|
public class ErrorExample {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
overflow();
|
throw new AssertionError();
|
||||||
}
|
|
||||||
|
|
||||||
public static void overflow() {
|
|
||||||
System.out.println("overflow...");
|
|
||||||
overflow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,11 @@ package com.baeldung.exception.exceptions_vs_errors;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
||||||
// Unit test for the ErrorExample class.
|
|
||||||
public class ErrorExampleUnitTest {
|
public class ErrorExampleUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenMainMethodIsRun_thenStackOverflowError() {
|
public void whenMainMethodIsRun_thenStackOverflowError() {
|
||||||
Assertions.assertThrows(StackOverflowError.class,
|
Assertions.assertThrows(AssertionError.class,
|
||||||
() -> ErrorExample.main(null));
|
() -> ErrorExample.main(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue