Skip to content

Commit

Permalink
unit test for SimpleDataStore (#1797)
Browse files Browse the repository at this point in the history
  • Loading branch information
beiwei30 authored May 15, 2018
1 parent 04eacfe commit f78f6d4
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@

import org.junit.Test;

import java.util.Map;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

public class SimpleDataStoreTest {
SimpleDataStore dataStore = new SimpleDataStore();
private SimpleDataStore dataStore = new SimpleDataStore();

@Test
public void testPut_Get() throws Exception {
public void testPutGet() throws Exception {
assertNull(dataStore.get("xxx", "yyy"));

dataStore.put("name", "key", "1");
Expand All @@ -42,4 +46,15 @@ public void testRemove() throws Exception {
dataStore.remove("name", "key");
assertNull(dataStore.get("name", "key"));
}

@Test
public void testGetComponent() throws Exception {
Map<String, Object> map = dataStore.get("component");
assertTrue(map != null && map.isEmpty());
dataStore.put("component", "key", "value");
map = dataStore.get("component");
assertTrue(map != null && map.size() == 1);
dataStore.remove("component", "key");
assertNotEquals(map, dataStore.get("component"));
}
}

0 comments on commit f78f6d4

Please sign in to comment.