Java JUnit: The method X is ambiguous for type Y

Posted by Rosarch on Stack Overflow See other posts from Stack Overflow or by Rosarch
Published on 2009-11-28T00:21:08Z Indexed on 2010/04/28 20:47 UTC
Read the original article Hit count: 529

Filed under:
|
|
|
|

I had some tests working fine. Then, I moved it to a different package, and am now getting errors. Here is the code:

import static org.junit.Assert.*;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.jgrapht.Graphs;
import org.jgrapht.WeightedGraph;
import org.jgrapht.graph.DefaultWeightedEdge;
import org.jgrapht.graph.SimpleWeightedGraph;
import org.junit.*; 

@Test
    public void testEccentricity() {
    	WeightedGraph<String, DefaultWeightedEdge> g = generateSimpleCaseGraph();
    	Map<String, Double> eccen = JGraphtUtilities.eccentricities(g);

    	assertEquals(70, eccen.get("alpha"));
    	assertEquals(80, eccen.get("l"));
    	assertEquals(130, eccen.get("l-0"));
    	assertEquals(100, eccen.get("l-1"));
    	assertEquals(90, eccen.get("r"));
    	assertEquals(120, eccen.get("r-0"));
    	assertEquals(130, eccen.get("r-1"));
    }

The error message is this:

The method assertEquals(Object, Object) is ambiguous for the type JGraphtUtilitiesTest

How can I fix this? Why did this problem occur as I moved the class to a different package?

© Stack Overflow or respective owner

Related posts about java

Related posts about junit