KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > net > sourceforge > pmd > symboltable > ImageFinderFunctionTest


1 /**
2  * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3  */

4 package test.net.sourceforge.pmd.symboltable;
5
6 import junit.framework.TestCase;
7 import net.sourceforge.pmd.ast.ASTVariableDeclaratorId;
8 import net.sourceforge.pmd.symboltable.ImageFinderFunction;
9 import net.sourceforge.pmd.symboltable.NameDeclaration;
10 import net.sourceforge.pmd.symboltable.VariableNameDeclaration;
11
12 import java.util.ArrayList JavaDoc;
13 import java.util.List JavaDoc;
14
15 public class ImageFinderFunctionTest extends TestCase {
16
17     public void testSingleImage() {
18         ImageFinderFunction f = new ImageFinderFunction("foo");
19         ASTVariableDeclaratorId node = new ASTVariableDeclaratorId(1);
20         node.setImage("foo");
21         NameDeclaration decl = new VariableNameDeclaration(node);
22         f.applyTo(decl);
23         assertEquals(decl, f.getDecl());
24     }
25
26     public void testSeveralImages() {
27         List JavaDoc imgs = new ArrayList JavaDoc();
28         imgs.add("Foo.foo");
29         imgs.add("foo");
30         ImageFinderFunction f = new ImageFinderFunction(imgs);
31         ASTVariableDeclaratorId node = new ASTVariableDeclaratorId(1);
32         node.setImage("foo");
33         NameDeclaration decl = new VariableNameDeclaration(node);
34         f.applyTo(decl);
35         assertEquals(decl, f.getDecl());
36     }
37 }
38
Popular Tags