Package org.djunits
Class Try
java.lang.Object
org.djunits.Try
public abstract class Try extends Object
Use the Try class as follows:
new Try( public @Override void execute() { // code to test that should fail }).test();
Copyright (c) 2019-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
- Author:
- Alexander Verbraeck
-
Constructor Summary
Constructors Constructor Description Try()
-
Method Summary
Modifier and Type Method Description abstract void
execute()
implement the execute method to test failure.void
test()
call the test method to test failure of the try.void
test(String message)
call the test method to test failure of the try.void
test(String message, Class<? extends Exception> expectedExceptionClass)
call the test method to test failure of the try with an expected exception type.
-
Constructor Details
-
Try
public Try()
-
-
Method Details
-
execute
public abstract void execute()implement the execute method to test failure. -
test
public void test()call the test method to test failure of the try. -
test
call the test method to test failure of the try.- Parameters:
message
- the message to print
-
test
call the test method to test failure of the try with an expected exception type.- Parameters:
message
- the message to printexpectedExceptionClass
- the expected exception
-