### Question:
Options extends TypedProperties { public Options setInto(Object obj) { Map.Entry entry = null; if (defaults != null) { for (Iterator<?> itr = defaults.entrySet().iterator(); itr.hasNext();) { entry = (Map.Entry) itr.next(); if (!containsKey(entry.getKey())) setInto(obj, entry); } } Options invalidEntries = null; Map.Entry e; for (Iterator<?> itr = entrySet().iterator(); itr.hasNext();) { e = (Map.Entry) itr.next(); if (!setInto(obj, e)) { if (invalidEntries == null) invalidEntries = new Options(); invalidEntries.put(e.getKey(), e.getValue()); } } return (invalidEntries == null) ? EMPTY : invalidEntries; } Options();  Options(Properties defaults); String[] setFromCmdLine(String[] args); Options setInto(Object obj); static Collection<String> findOptionsFor(Class<?> type); boolean getBooleanProperty(String key, String key2, boolean def); float getFloatProperty(String key, String key2, float def); double getDoubleProperty(String key, String key2, double def); long getLongProperty(String key, String key2, long def); int getIntProperty(String key, String key2, int def); String getProperty(String key, String key2, String def); boolean removeBooleanProperty(String key, String key2, boolean def); float removeFloatProperty(String key, String key2, float def); double removeDoubleProperty(String key, String key2, double def); long removeLongProperty(String key, String key2, long def); int removeIntProperty(String key, String key2, int def); String removeProperty(String key, String key2, String def); static Options EMPTY; }### Answer:
@Test public void testSetObject() { Inner inner = new Inner(); _opts.setInto(inner); assertEquals(10, inner.getInt()); assertTrue(inner.getBoolean()); assertEquals("STR,STR2", inner.getString()); assertEquals(20, inner.fieldVal); assertEquals(30, inner.fieldVal2); assertEquals(10, inner.getRange1()[0]); assertEquals(100, inner.getRange1()[1]); assertEquals(10, inner.getRange2()[0]); assertEquals(0, inner.getRange2()[1]); assertEquals("value", inner.getDefault()); assertEquals(10, inner.getInner().getNullInner().getRange1()[0]); assertEquals(100, inner.getInner().getNullInner().getRange1()[1]); inner = new Inner(); Options opts = new Options(); opts.setProperty("inner", Inner2.class.getName()); opts.setInto(inner); assertEquals(Inner2.class, inner.getInner().getClass()); inner = new Inner(); opts = new Options(); opts.setProperty("mixed", "STR,1"); opts.setInto(inner); assertEquals(1, inner.getInt()); assertEquals("STR", inner.getString()); }