小编Yos*_*sia的帖子

Java 初学者使用 JUnit 测试 ArrayList 大小

    @Test
    @DisplayName("Get all Points in Shape is working and gets the correct number output")
    public void test_Get_All_Points_On_Shape()
    {
        ArrayList<Point> points = new ArrayList<Point>(Arrays.asList(new Point[4]));
        assertEquals(points.size() == 4);
    }
Run Code Online (Sandbox Code Playgroud)

上面的代码给出了一个错误

The method assertEquals(short, short) in the type Assertions is not applicable for the arguments (boolean)
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题?

java junit

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

java ×1

junit ×1