我的技术博客经常被流氓网站恶意爬取转载。请移步原文:http://www.cnblogs.com/hamhog/p/3824934.html,享受整齐的排版、有效的链接、正确的代码缩进、更好的阅读体验。

不多说了,贴两段代码。

HelloWorld类:

public class HelloWorld {
    
    public void main() {
        System.out.println(helloWorld());
    }
    
    public static String helloWorld() {
        return "Hello World!";
    }

}

TestHelloWord

import static org.junit.Assert;
import org.junit.Test;

public class TestHelloWorld {
    
    @Test public void helloWorldNormal() {
        String result = HelloWorld.helloWorld();
        Assert.assertEquals("Hello World!", result);
    }

}

这就是一个简单的单元测试啦。没有想象的复杂吧:)

相关文章:

  • 2021-11-18
  • 2021-12-26
  • 2021-08-01
  • 2022-12-23
  • 2021-04-01
  • 2021-07-19
  • 2022-02-07
猜你喜欢
  • 2022-02-07
  • 2021-07-06
  • 2022-12-23
  • 2021-12-30
  • 2022-02-12
  • 2022-12-23
相关资源
相似解决方案