34 lines
No EOL
1.1 KiB
Java
34 lines
No EOL
1.1 KiB
Java
package dev.peerat.parser.java.element.operation;
|
|
|
|
import static org.junit.Assert.assertTrue;
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
import dev.peerat.parser.java.Function;
|
|
import dev.peerat.parser.java.element.BaseElementTests;
|
|
import dev.peerat.parser.java.operation.BreakOperation;
|
|
import dev.peerat.parser.java.operation.ForOperation;
|
|
import dev.peerat.parser.java.operation.Operation;
|
|
|
|
public class TryCatchFinallyOperationTest extends BaseElementTests{
|
|
|
|
{
|
|
register(
|
|
"package be.jeffcheasey88;"
|
|
+ ""
|
|
+ "public static class Test{ "
|
|
+ " void test(){ "
|
|
+ " try{}catch(Exception e){}"
|
|
+ "}"
|
|
+ "}",
|
|
(javafile) -> {
|
|
Function function = checkFunction(checkClass(javafile).getElements().get(0));
|
|
assertEquals(1, function.getElements().size());
|
|
Operation op = checkOperation(function.getElements().get(0));
|
|
assertTrue(op instanceof ForOperation);
|
|
ForOperation forOp = (ForOperation)op;
|
|
Operation o = checkOperation(forOp.getElements().get(0));
|
|
assertTrue(o instanceof BreakOperation);
|
|
});
|
|
|
|
}
|
|
} |