1818
1919import org .junit .Test ;
2020
21+ import java .util .Map ;
22+
2123import static org .junit .Assert .assertEquals ;
24+ import static org .junit .Assert .assertNotEquals ;
2225import static org .junit .Assert .assertNull ;
26+ import static org .junit .Assert .assertTrue ;
2327
2428public 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