34 lines
845 B
Java
34 lines
845 B
Java
// annotations/HashSetTest.java
|
|
// (c)2016 MindView LLC: see Copyright.txt
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
|
// {main: onjava.atunit.AtUnit}
|
|
// {Args: 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 _contains() {
|
|
testObject.add("one");
|
|
assert testObject.contains("one");
|
|
}
|
|
@Test void _remove() {
|
|
testObject.add("one");
|
|
testObject.remove("one");
|
|
assert testObject.isEmpty();
|
|
}
|
|
}
|
|
/* Output:
|
|
annotations.HashSetTest
|
|
. initialization
|
|
. _contains
|
|
. _remove
|
|
OK (3 tests)
|
|
*/
|