Search in sources :

Example 6 with Factorial

use of org.whole.lang.java.codebase.Factorial in project whole by wholeplatform.

the class ScannerTest method testPatternIterator.

@Test
public void testPatternIterator() {
    IEntity fact = new Factorial().create();
    IEntityIterator<IEntity> i = IteratorFactory.childMatcherIterator().withPattern(JavaEntityDescriptorEnum.MethodDeclaration);
    i.reset(fact);
    while (i.hasNext()) {
        MethodDeclaration md = (MethodDeclaration) i.next();
        md.getName();
    }
}
Also used : Factorial(org.whole.lang.java.codebase.Factorial) IEntity(org.whole.lang.model.IEntity) MethodDeclaration(org.whole.lang.java.model.MethodDeclaration) Test(org.junit.Test)

Example 7 with Factorial

use of org.whole.lang.java.codebase.Factorial in project whole by wholeplatform.

the class ScannerTest method testFindFirst.

@Test
public void testFindFirst() {
    IEntity fact = new Factorial().create();
    IEntity var = Matcher.find(mf.hasTypeMatcher(JavaEntityDescriptorEnum.Block), fact, false);
    Assert.assertNotNull(var);
}
Also used : Factorial(org.whole.lang.java.codebase.Factorial) IEntity(org.whole.lang.model.IEntity) Test(org.junit.Test)

Example 8 with Factorial

use of org.whole.lang.java.codebase.Factorial in project whole by wholeplatform.

the class ScannerTest method testFindAll.

@Test
public void testFindAll() {
    IEntity fact = new Factorial().create();
    List<IEntity> c = new ArrayList<IEntity>();
    Matcher.findAll(mf.hasTypeMatcher(JavaEntityDescriptorEnum.Assignment), fact, c, false);
    Matcher.findAll(mf.hasTypeMatcher(JavaEntityDescriptorEnum.SingleVariableDeclaration), fact, c, false);
    Assert.assertEquals(3 + 2, c.size());
}
Also used : Factorial(org.whole.lang.java.codebase.Factorial) IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 Factorial (org.whole.lang.java.codebase.Factorial)8 IEntity (org.whole.lang.model.IEntity)8 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 MethodDeclaration (org.whole.lang.java.model.MethodDeclaration)1