37 lines
824 B
Java
37 lines
824 B
Java
// 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
|
|
. tRemove
|
|
. tContains
|
|
. initialization
|
|
OK (3 tests)
|
|
*/
|