diff options
Diffstat (limited to 'javaparser-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalScopeTest.java')
-rw-r--r-- | javaparser-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalScopeTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/javaparser-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalScopeTest.java b/javaparser-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalScopeTest.java new file mode 100644 index 000000000..ad7e8bd7e --- /dev/null +++ b/javaparser-testing/src/test/java/com/github/javaparser/ast/nodeTypes/NodeWithOptionalScopeTest.java @@ -0,0 +1,28 @@ +package com.github.javaparser.ast.nodeTypes; + +import com.github.javaparser.ast.expr.*; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class NodeWithOptionalScopeTest { + + @Test + public void commonExpressionWhichHaveInterfaceNodeWithOptionalScope() { + NodeWithOptionalScope methodCallExpr = new MethodCallExpr(new NameExpr("A"), "call"); + NodeWithOptionalScope objectCreationExpr = new ObjectCreationExpr(); + + assertTrue(methodCallExpr.getScope().isPresent()); + assertFalse(objectCreationExpr.getScope().isPresent()); + } + + @Test + public void removeScope() { + MethodCallExpr methodCallExpr = new MethodCallExpr(new NameExpr("A"), "method"); + + methodCallExpr.removeScope(); + + assertFalse(methodCallExpr.getScope().isPresent()); + } +} |