Esempio n. 1
0
 /**
  * Test of getValueStringByKey method, of class Tools. Input: keyName=null Expect: empty string
  */
 @Test
 public void testGetValueStringByKeyKeyNameNull() {
   Map<String, String> map = new HashMap<String, String>();
   String keyName = null;
   String expResult = "";
   String result = Tools.getValueStringByKey(map, keyName);
   assertEquals(expResult, result);
 }
Esempio n. 2
0
 /**
  * Test of getValueStringByKey method, of class Tools. Input: map=valid map, keyName=valid string
  * Expect: value of the key
  */
 @Test
 public void testGetValueStringByKeyGoodCase() {
   HashMap<String, String> map = new HashMap<String, String>();
   map.put("key1", "value1");
   map.put("key2", "value2");
   map.put("key3", "value3");
   String keyName = "key2";
   String expResult = "value2";
   String result = Tools.getValueStringByKey(map, keyName);
   assertEquals(expResult, result);
 }