### Question:
PropertyUtils { public static String get(Properties props, String name) { String value = props.getProperty(name); if (value == null) throw new DukeConfigException("Required property " + name + " not specified"); return value; }  static String get(Properties props, String name); static String get(Properties props, String name, String defval); static int get(Properties props, String name, int defval);  }### Answer:
@Test public void testGet1() { assertEquals(PropertyUtils.get(props, "foo"), "bar"); try { PropertyUtils.get(props, "bar"); fail("exception not thrown"); } catch (DukeConfigException e) { } }
@Test public void testGet2() { assertEquals(PropertyUtils.get(props, "foo", "huhu"), "bar"); assertEquals(PropertyUtils.get(props, "quux", "huhu"), "huhu"); }
@Test public void testGet3() { assertEquals(PropertyUtils.get(props, "baz", 0), 2); assertEquals(PropertyUtils.get(props, "quux", 27), 27); }