beiwei30 closed pull request #1797: unit test for SimpleDataStore URL: https://github.com/apache/incubator-dubbo/pull/1797
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/dubbo-common/src/test/java/com/alibaba/dubbo/common/store/support/SimpleDataStoreTest.java b/dubbo-common/src/test/java/com/alibaba/dubbo/common/store/support/SimpleDataStoreTest.java index 42de80d517..0b81a9ad67 100644 --- a/dubbo-common/src/test/java/com/alibaba/dubbo/common/store/support/SimpleDataStoreTest.java +++ b/dubbo-common/src/test/java/com/alibaba/dubbo/common/store/support/SimpleDataStoreTest.java @@ -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"); @@ -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")); + } } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org