Search in sources :

Example 1 with VariableDescriptor

use of com.buschmais.jqassistant.plugin.java.api.model.VariableDescriptor in project jqa-java-plugin by buschmais.

the class PojoIT method variables.

@Test
public void variables() throws IOException {
    scanClasses(Pojo.class);
    store.beginTransaction();
    List<VariableDescriptor> variables = query("MATCH (:Java:Method{name:'equals'})-[:DECLARES]->(v:Java:Variable) return v").getColumn("v");
    assertThat(variables.size(), equalTo(2));
    Map<String, VariableDescriptor> map = new HashMap<>();
    for (VariableDescriptor variable : variables) {
        map.put(variable.getName(), variable);
    }
    VariableDescriptor o = map.get("o");
    assertThat(o, notNullValue());
    assertThat(o.getSignature(), equalTo(Object.class.getName() + " o"));
    assertThat(o.getType(), typeDescriptor(Object.class));
    VariableDescriptor pojo = map.get("pojo");
    assertThat(pojo, notNullValue());
    assertThat(pojo.getSignature(), equalTo(Pojo.class.getName() + " pojo"));
    assertThat(pojo.getType(), typeDescriptor(Pojo.class));
    store.commitTransaction();
}
Also used : Pojo(com.buschmais.jqassistant.plugin.java.test.set.scanner.pojo.Pojo) HashMap(java.util.HashMap) VariableDescriptor(com.buschmais.jqassistant.plugin.java.api.model.VariableDescriptor) Test(org.junit.Test)

Aggregations

VariableDescriptor (com.buschmais.jqassistant.plugin.java.api.model.VariableDescriptor)1 Pojo (com.buschmais.jqassistant.plugin.java.test.set.scanner.pojo.Pojo)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1