Class ExceptionTracker
java.lang.Object
com.luchersol.core.util.ExceptionTracker
ExceptionTracker tracks and manages exceptions thrown, not thrown, and not checked during validation or testing.
It provides methods to add, merge, and display categorized exceptions with colored output.
-
Constructor Summary
ConstructorsConstructorDescriptionExceptionTracker(String name) Constructs an ExceptionTracker for the given name. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an exception to the list of not checked exceptions.voidAdds an exception to the list of not thrown exceptions.voidAdds an exception to the list of thrown exceptions.static ExceptionTrackerCreates an empty ExceptionTracker for the given name.Returns the map of not thrown exceptions categorized by name.Returns the map of thrown exceptions categorized by name.booleanChecks if there are any thrown exceptions.booleanChecks if there are no thrown exceptions.voidmerge(ExceptionTracker exceptionTracker) Merges another ExceptionTracker's exceptions into this one, combining all categories by name.voidshow()Displays all categories of exceptions: thrown, not thrown, and not checked.voidDisplays all not checked exceptions in yellow color.voidDisplays all not thrown exceptions in green color.voidDisplays all thrown exceptions in red color.
-
Constructor Details
-
ExceptionTracker
Constructs an ExceptionTracker for the given name.- Parameters:
name- the name associated with this tracker
-
-
Method Details
-
empty
Creates an empty ExceptionTracker for the given name.- Parameters:
name- the name associated with this tracker- Returns:
- a new ExceptionTracker instance
-
addThrownException
Adds an exception to the list of thrown exceptions.- Parameters:
e- the exception that was thrown
-
addPassedChecks
Adds an exception to the list of not thrown exceptions.- Parameters:
e- the exception that was expected but not thrown
-
addNotCheckedException
Adds an exception to the list of not checked exceptions.- Parameters:
e- the exception that was not checked
-
getThrownExceptions
Returns the map of thrown exceptions categorized by name.- Returns:
- the map of thrown exceptions
-
getPassedChecks
Returns the map of not thrown exceptions categorized by name.- Returns:
- the map of not thrown exceptions
-
merge
Merges another ExceptionTracker's exceptions into this one, combining all categories by name.- Parameters:
exceptionTracker- the ExceptionTracker to merge from
-
hasErrors
public boolean hasErrors()Checks if there are any thrown exceptions.- Returns:
- true if there are thrown exceptions, false otherwise
-
hasNotErrors
public boolean hasNotErrors()Checks if there are no thrown exceptions.- Returns:
- true if there are no thrown exceptions, false otherwise
-
showThrownException
public void showThrownException()Displays all thrown exceptions in red color. -
showPassedChecks
public void showPassedChecks()Displays all not thrown exceptions in green color. -
showNotCheckedThrownException
public void showNotCheckedThrownException()Displays all not checked exceptions in yellow color. -
show
public void show()Displays all categories of exceptions: thrown, not thrown, and not checked.
-