方法断言java项目中有复杂错误

时间:2018-06-12 18:17:31

标签: java junit environment-variables assert

我正在尝试编译一个java项目。我的代码中出现以下错误。我做错了什么?

import java.lang.reflect.Field;
import java.util.Map;
import java.lang.Object;
import static org.junit.Assert.*;
import static org.junit.Assert.assertThat;
import java.lang.String;
import org.junit.Test;
public class EnvironmentsTest {

@Test
public void testGetFoobar() throws Exception {
    assertNull(System.getenv("MY_VAR"));

    injectEnvironmentVariable("MY_VAR", "my_var");

    assertThat(System.getenv("MY_VAR"), is("my_var"));
}


cannot find symbol
symbol:   method is(java.lang.String)
location: class EnvironmentsTest

3 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

导入是:

val df =spark.read.jdbc(url = "SomeSQLServerURL",
                table = "(select * from sample.testTable ) a",
                columnName = "x",
                lowerBound = 1,
                upperBound = 10000,
                numPartitions = 100,
                connectionProperties
                )

答案 2 :(得分:0)

类型为(),然后按Alt + Enter单击“导入静态方法。”
您可以添加CoreMatchers.is。

like this