junit4:如何在junit4 @before 或@Test 中调用另一个class 静态方法?

junit4: How to call the other class static method in junit4 @before or @Test?

如何在junit4@Before@Test中调用另一个class静态方法?

我有一个关于如何在 junit4 @Test@Before 中调用另一个 class 方法的问题?

比如我在UtilTool

中写了一个static方法
public static String readAllBytes(String filePath) {
    String content = "";

    try {
        content = new String(Files.readAllBytes(Paths.get(filePath)));
    } catch (IOException e) {
        e.printStackTrace();
    }

    return content;
}

使用junit4中的define方法@Before:

@Before
public void setUp() {
    System.out.println("setUp......");
    UtilTool.readAllBytes("/tmp/test.txt")

但是当我在 Junit4 @Before@Test

中从 UtilTool 调用 readAllBytes 方法时,我会收到以下错误消息
java.lang.NoSuchMethodError: ..... 

我该如何解决这个问题?

我已经解决了这个问题,我犯了一个愚蠢的错误。我忘记替换类路径中的旧 jar。谢谢!