1 Star 0 Fork 0

ThisYoung/OnJava8-Examples

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
HashSetTest.java 824 Bytes
Copy Edit Raw Blame History
Bruce Eckel authored 2017-05-11 01:45 +08:00 . Narrowed listing widths, fixed output
// annotations/HashSetTest.java
// (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
// {java onjava.atunit.AtUnit
// build/classes/main/annotations/HashSetTest.class}
package annotations;
import java.util.*;
import onjava.atunit.*;
import onjava.*;
public class HashSetTest {
HashSet<String> testObject = new HashSet<>();
@Test
void initialization() {
assert testObject.isEmpty();
}
@Test
void tContains() {
testObject.add("one");
assert testObject.contains("one");
}
@Test
void tRemove() {
testObject.add("one");
testObject.remove("one");
assert testObject.isEmpty();
}
}
/* Output:
annotations.HashSetTest
. initialization
. tRemove
. tContains
OK (3 tests)
*/
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/thisyoung/OnJava8-Examples.git
git@gitee.com:thisyoung/OnJava8-Examples.git
thisyoung
OnJava8-Examples
OnJava8-Examples
master

Search