package structure.trees;

import org.junit.Assert;
import org.junit.Test;

public class TernarySearchTriesSearchTest {

	private static final String DUMMY_KEY = "DUMMY_KEY";

	@Test
	public void testContainsWithoutPut() throws Exception {
		TernarySearchTriesSearch<Integer> s = new TernarySearchTriesSearch<Integer>();

		boolean actual = s.contains(DUMMY_KEY);

		Assert.assertEquals(false, actual);
	}

	@Test
	public void testGetWithoutPut() throws Exception {
		TernarySearchTriesSearch<Integer> s = new TernarySearchTriesSearch<Integer>();

		Integer actual = s.get(DUMMY_KEY);

		Assert.assertEquals(null, actual);
	}

	@Test
	public void testContainsAfterPut() throws Exception {
		TernarySearchTriesSearch<Integer> s = new TernarySearchTriesSearch<Integer>();
		s.put(DUMMY_KEY, 1);

		boolean actual = s.contains(DUMMY_KEY);

		Assert.assertEquals(true, actual);
	}

	@Test
	public void testGetAfterPut() throws Exception {
		TernarySearchTriesSearch<Integer> s = new TernarySearchTriesSearch<Integer>();
		Integer expected = 1;
		s.put(DUMMY_KEY, expected);

		Integer actual = s.get(DUMMY_KEY);

		Assert.assertEquals(expected, actual);
	}
}

@@ -1144,11 +1144,514 @@
 ual);%0A%09%7D
+%0A%0A%09@Test%0A%09public void testDelete() throws Exception %7B%0A%09%09TernarySearchTriesSearch%3CInteger%3E s = new TernarySearchTriesSearch%3CInteger%3E();%0A%09%09s.delete(DUMMY_KEY);%0A%0A%09%09Integer actual = s.get(DUMMY_KEY);%0A%0A%09%09Assert.assertEquals(null, actual);%0A%09%7D%0A%0A%09@Test%0A%09public void testDeleteAfterPut() throws Exception %7B%0A%09%09TernarySearchTriesSearch%3CInteger%3E s = new TernarySearchTriesSearch%3CInteger%3E();%0A%09%09s.put(DUMMY_KEY, 1);%0A%09%09s.delete(DUMMY_KEY);%0A%0A%09%09Integer actual = s.get(DUMMY_KEY);%0A%0A%09%09Assert.assertEquals(null, actual);%0A%09%7D
 %0A%7D%0A

Test deletions