JAVA-618 Move code for 3 articles from core-java-exceptions to core-java-exceptions-2
This commit is contained in:
parent
3a0d19d9d3
commit
f1dde2936b
|
@ -9,3 +9,6 @@ This module contains articles about core java exceptions
|
|||
- [java.net.UnknownHostException: Invalid Hostname for Server](https://www.baeldung.com/java-unknownhostexception)
|
||||
- [How to Handle Java SocketException](https://www.baeldung.com/java-socketexception)
|
||||
- [Java Suppressed Exceptions](https://www.baeldung.com/java-suppressed-exceptions)
|
||||
- [Java – Try with Resources](https://www.baeldung.com/java-try-with-resources)
|
||||
- [Java Global Exception Handler](https://www.baeldung.com/java-global-exception-handler)
|
||||
- [How to Find an Exception’s Root Cause in Java](https://www.baeldung.com/java-exception-root-cause)
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
<version>${assertj-core.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons.lang3.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<description> </description>
|
||||
|
@ -30,6 +35,7 @@
|
|||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<commons.lang3.version>3.10</commons.lang3.version>
|
||||
<!-- testing -->
|
||||
<assertj-core.version>3.10.0</assertj-core.version>
|
||||
</properties>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.rootcausefinder;
|
||||
package com.baeldung.rootcausefinder;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.exceptions.globalexceptionhandler;
|
||||
package com.baeldung.globalexceptionhandler;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
|
@ -1,7 +1,7 @@
|
|||
package com.baeldung.exceptions.rootcausefinder;
|
||||
package com.baeldung.rootcausefinder;
|
||||
|
||||
import com.baeldung.exceptions.rootcausefinder.RootCauseFinder.CalculationException;
|
||||
import com.baeldung.exceptions.rootcausefinder.RootCauseFinder.DateOutOfRangeException;
|
||||
import com.baeldung.rootcausefinder.RootCauseFinder.CalculationException;
|
||||
import com.baeldung.rootcausefinder.RootCauseFinder.DateOutOfRangeException;
|
||||
import com.google.common.base.Throwables;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
@ -11,8 +11,7 @@ import java.time.LocalDate;
|
|||
import java.time.format.DateTimeParseException;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
import static com.baeldung.exceptions.rootcausefinder.RootCauseFinder.AgeCalculator;
|
||||
import static com.baeldung.exceptions.rootcausefinder.RootCauseFinder.findCauseUsingPlainJava;
|
||||
import static com.baeldung.rootcausefinder.RootCauseFinder.AgeCalculator;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +37,7 @@ public class RootCauseFinderUnitTest {
|
|||
try {
|
||||
AgeCalculator.calculateAge("010102");
|
||||
} catch (CalculationException ex) {
|
||||
assertTrue(findCauseUsingPlainJava(ex) instanceof DateTimeParseException);
|
||||
assertTrue(RootCauseFinder.findCauseUsingPlainJava(ex) instanceof DateTimeParseException);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +46,7 @@ public class RootCauseFinderUnitTest {
|
|||
try {
|
||||
AgeCalculator.calculateAge("2020-04-04");
|
||||
} catch (CalculationException ex) {
|
||||
assertTrue(findCauseUsingPlainJava(ex) instanceof DateOutOfRangeException);
|
||||
assertTrue(RootCauseFinder.findCauseUsingPlainJava(ex) instanceof DateOutOfRangeException);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +55,7 @@ public class RootCauseFinderUnitTest {
|
|||
try {
|
||||
AgeCalculator.calculateAge(null);
|
||||
} catch (Exception ex) {
|
||||
assertTrue(findCauseUsingPlainJava(ex) instanceof IllegalArgumentException);
|
||||
assertTrue(RootCauseFinder.findCauseUsingPlainJava(ex) instanceof IllegalArgumentException);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,9 +12,5 @@ This module contains articles about core java exceptions
|
|||
- [“Sneaky Throws” in Java](https://www.baeldung.com/java-sneaky-throws)
|
||||
- [The StackOverflowError in Java](https://www.baeldung.com/java-stack-overflow-error)
|
||||
- [Checked and Unchecked Exceptions in Java](https://www.baeldung.com/java-checked-unchecked-exceptions)
|
||||
- [Java – Try with Resources](https://www.baeldung.com/java-try-with-resources)
|
||||
- [Java Global Exception Handler](https://www.baeldung.com/java-global-exception-handler)
|
||||
- [Common Java Exceptions](https://www.baeldung.com/java-common-exceptions)
|
||||
- [How to Find an Exception’s Root Cause in Java](https://www.baeldung.com/java-exception-root-cause)
|
||||
- [Is It a Bad Practice to Catch Throwable?](https://www.baeldung.com/java-catch-throwable-bad-practice)
|
||||
- [[Next -->]](/core-java-modules/core-java-exceptions-2)
|
Loading…
Reference in New Issue