gpt4 book ai didi

intellij-idea - Intellij "java: package org.junit does not exist"

转载 作者:行者123 更新时间:2023-12-04 05:30:14 28 4
gpt4 key购买 nike

当我尝试运行测试时,出现以下错误:
我在谷歌上查找并在谷歌上找到了一些东西,但这没有帮助。

Error:(3, 24) java: package org.junit does not exist
Error:(3, 1) java: static import only from classes and interfaces
Error:(5, 17) java: package org.junit does not exist
Error:(6, 17) java: package org.junit does not exist
Error:(12, 10) java: cannot find symbol
symbol: class Before
location: class edu.kit.ipd.swt1.SimpleEditMeTest
Error:(17, 10) java: cannot find symbol
symbol: class Test
location: class edu.kit.ipd.swt1.SimpleEditMeTest
[...]

我的测试代码:
package edu.kit.ipd.swt1;
import static org.junit.Assert.assertNotNull;
import org.junit.Before;
import org.junit.Test;

public class SimpleEditMeTest {
private EditMe editMe;
@Before
public void setUp() throws Exception {
editMe = new EditMe();
}
@Test
public void test() {
assertNotNull(editMe.getFoo());
}
}

Screenshot of the whole project

Run configurations

依赖项 i.stack.imgur。 com/OiQWU.png(不能发布超过 2 个链接)

最佳答案

这对我有用:

  • 右键 pom.xml
  • 选择 Maven
  • 重新加载项目
  • 关于intellij-idea - Intellij "java: package org.junit does not exist",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29749334/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com