Skip to content

Commit f78f6d4

Browse files
authored
unit test for SimpleDataStore (#1797)
1 parent 04eacfe commit f78f6d4

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

dubbo-common/src/test/java/com/alibaba/dubbo/common/store/support/SimpleDataStoreTest.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@
1818

1919
import org.junit.Test;
2020

21+
import java.util.Map;
22+
2123
import static org.junit.Assert.assertEquals;
24+
import static org.junit.Assert.assertNotEquals;
2225
import static org.junit.Assert.assertNull;
26+
import static org.junit.Assert.assertTrue;
2327

2428
public class SimpleDataStoreTest {
25-
SimpleDataStore dataStore = new SimpleDataStore();
29+
private SimpleDataStore dataStore = new SimpleDataStore();
2630

2731
@Test
28-
public void testPut_Get() throws Exception {
32+
public void testPutGet() throws Exception {
2933
assertNull(dataStore.get("xxx", "yyy"));
3034

3135
dataStore.put("name", "key", "1");
@@ -42,4 +46,15 @@ public void testRemove() throws Exception {
4246
dataStore.remove("name", "key");
4347
assertNull(dataStore.get("name", "key"));
4448
}
49+
50+
@Test
51+
public void testGetComponent() throws Exception {
52+
Map<String, Object> map = dataStore.get("component");
53+
assertTrue(map != null && map.isEmpty());
54+
dataStore.put("component", "key", "value");
55+
map = dataStore.get("component");
56+
assertTrue(map != null && map.size() == 1);
57+
dataStore.remove("component", "key");
58+
assertNotEquals(map, dataStore.get("component"));
59+
}
4560
}

0 commit comments

Comments
 (0)