@Override @Test @... 注解

简介: @Override 表示覆盖父类的方法。 @Test 在Package Explorer视图中,右击想要建立单元测试的java文件,然后New|JUnit Test Case。 选中想要测试的方法。 在@Test打头的方法中给出具体实现。然后Run as Junit Test。 两个源文件 @SupressWarnings 用来压制编译器的告警

@Override

表示覆盖父类的方法。


@Test

在Package Explorer视图中,右击想要建立单元测试的java文件,然后New|JUnit Test Case。
选中想要测试的方法。

在@Test打头的方法中给出具体实现。然后Run as Junit Test。


两个源文件

@SupressWarnings

用来压制编译器的告警

关键字

用途

deprecation

使用了不赞成使用的类或方法时的警告

unchecked

执行了未检查的转换时的警告,例如当使用集合时没有用泛型(Generics) 来指定集合保存的类型。

fallthrough

当 Switch 程序块直接通往下一种情况而没有 Break 时的警告。

path

在类路径、源文件路径等中有不存在的路径时的警告。

serial

当在可序列化的类上缺少 serialVersionUID 定义时的警告。

finally

任何 finally 子句不能正常完成时的警告。

all

关于以上所有情况的警告。


目录
相关文章
|
4月前
|
Java 数据安全/隐私保护
java中public、private、protected作用范围
该内容是关于Java中访问修饰符的范围总结:`public`(全局访问)、`protected`(同包及子类访问)、默认(同包访问)、`private`(仅本类访问)。
60 6
|
3月前
|
安全 Java 编译器
springboot @resource与private final声明式的有何区别??
【6月更文挑战第3天】在Spring Boot中,@Resource 和 private final 常用于依赖注入,但它们的用途和行为有一些重要的区别。
127 1
|
4月前
使用EventBus 3.0 报 Subscriber class com.example.test.MainActivity and its super classes have no public methods with the @Subscribe annotation
使用EventBus 3.0 报 Subscriber class com.example.test.MainActivity and its super classes have no public methods with the @Subscribe annotation
82 5
|
4月前
|
PHP
PHP public、protected、private、static、abstract、final、interface、implements 区别对比
PHP public、protected、private、static、abstract、final、interface、implements 区别对比
53 0
|
4月前
|
Java 编译器 Maven
@Data@NoArgsConstructor@AllArgsConstructor 这几个常用注解什么意思?
@Data@NoArgsConstructor@AllArgsConstructor 这几个常用注解什么意思?
169 1
|
存储 C++
【C++类】 -- 类与static
【C++类】 -- 类与static
57 0
|
Java
Java 权限修饰符(private、protected、public、默认、final、static)
Java 权限修饰符(private、protected、public、默认、final、static)
155 0
|
JavaScript 小程序 Java
Controller中的请求方法,private和public有什么区别?
Controller中的请求方法,private和public有什么区别?
class CSplitterWnd :public CSplitterWnd
class CSplitterWnd :public CSplitterWnd
67 0
【Junit 报错】Test class should have exactly one public zero-argument constructor和Test class can only have one constructor
错误1: 1 java.lang.Exception: Test class should have exactly one public zero-argument constructor 2 at org.
6137 0