← Back to team overview

gephi.team team mailing list archive

Re: [Question #157804]: Unit testing problems

 

Question #157804 on Gephi changed:
https://answers.launchpad.net/gephi/+question/157804

    Status: Answered => Open

Artem OBOTUROV is still having a problem:
If I don't make a dependency on AttributesImpl and DHNS it will always
give me NPE, because Lookup can't resolve @ServiceProvider's (they are
implemented in AttributesImpl and DHNS respectively for
AttributeController and GraphController).

Test is below:
================================= SimpleTest.java ===========================
import org.gephi.data.attributes.api.AttributeController;
import org.gephi.data.attributes.api.AttributeModel;
import org.gephi.graph.api.GraphController;
import org.gephi.graph.api.GraphModel;
import org.gephi.project.api.ProjectController;
import org.junit.Test;
import org.openide.util.Lookup;

/**
 * @author Artem OBOTUROV
 */
public class SimpleTest {

    @Test
    public void testEvaluateQvalue() throws Exception {
        ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
        projectController.newProject();
        AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
        AttributeModel attributeModel = attributeController.getModel();
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        GraphModel graphModel = graphController.getModel();
    }

}
======================================================================


And if add AttributesImpl as a dependency for my module I will have build error because it will generate an empty jar for org-gephi-attibutes.jar

Regards,
Artem

-- 
You received this question notification because you are a member of
Gephi Team, which is an answer contact for Gephi.