import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Test; public class MyMathTest { @Test public void testAddition() { int result = MyMath.add(2, 3); MatcherAssert.assertThat(result, CoreMatchers.is(5)); } @Test public void testSubtraction() { int result = MyMath.subtract(5, 3); MatcherAssert.assertThat(result, CoreMatchers.greaterThan(2)); } }


上一篇:
下一篇:
切换中文