summaryrefslogtreecommitdiff
path: root/src/test/java/bjc/esodata/ThresholdSetTest.java
blob: b37f866537a97a3f029ada3245c80d7fe9a73179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package bjc.esodata;

import org.junit.Test;

import bjc.TestUtils;
import bjc.esodata.ThresholdSet;

import java.util.Iterator;

import static bjc.TestUtils.*;
import static org.junit.Assert.*;

/**
 * Tests for ThresholdSet
 *
 * @author Ben Culkin.
 */
public class ThresholdSetTest {
	@Test
	public void testAdd() {
		ThresholdSet<String> thst = new ThresholdSet<>();

		thst.addKeys("a", "b");

		assertIteratorEquals(false, thst.setView().iterator(), "a", "b");
	}

	@Test
	public void testAddMulti() {
		ThresholdSet<String> thst = new ThresholdSet<>();

		thst.addKeys("a", "b", "a");

		assertIteratorEquals(false, thst.setView().iterator(), "b");
	}

	@Test
	public void testRemoveMulti() {
		ThresholdSet<String> thst = new ThresholdSet<>();

		thst.addKeys("a", "a", "b");
		thst.removeKeys("a");

		assertIteratorEquals(false, thst.setView().iterator(), "a", "b");
	}
}