![](/img/trans.png)
[英]File object creation fails when running code as Junit test in Eclipse/STS
[英]Eclipse/STS does not suggests autocompleting for JUnit code
我有一个简单的项目,配置了我在下面复制的 pom.xml 文件。 问题是 Spring Tool Suite 4.9.0.RELEASE 不建议自动完成 JUnit 库中的类和方法。 如果我写这样的代码:
Assert.assertEquals(text_1, text_2);
它可以编译并且可以工作,但是如果我将鼠标 cursor 放在Assert
之后的点之后并按Ctrl + 。 显示“无默认提议”消息。 对于 JUnit 之外的其他类,自动完成建议工作正常。
我按照其他问题中的建议检查了配置,但没有解决此问题。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.microservices</groupId>
<artifactId>Module</artifactId>
<version>1.0.0</version>
<name>module</name>
<description>Module tools</description>
<properties>
<springframework.version>2.1.4.RELEASE</springframework.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>
${project.name}
</finalName>
</build>
</project>
删除.metadata
和.settings
文件夹以及.project
和.classpath
文件似乎已经解决了这个问题(除了重新启动 Eclipse 并再次导入项目)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.