You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MiNote/test/ExampleUnitTest.java

25 lines
706 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package net.micode.notes;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* 示例本地单元测试类
* 功能演示JUnit框架在Android项目中的基本用法
* 运行环境开发主机非Android设备
* 测试范围不依赖Android系统API的纯Java逻辑
*/
public class ExampleUnitTest {
/**
* 加法运算测试方法
* 测试目标验证2 + 2的结果是否等于4
* 断言类型assertEquals预期值实际值
*/
@Test
public void addition_isCorrect() {
// 验证整数加法运算的正确性
// 若2 + 2不等于4测试将失败并抛出AssertionError
assertEquals(4, 2 + 2);
}
}