/** Test for createModification() when no additional parameters exist. */ @SuppressWarnings("nls") @Test public void testCreateModification_forCriteriaDependentClass() { Properties p = sample(); String field1 = "field1"; String field2 = "field2"; String property1 = "property1"; String f1 = "f1"; Integer f2 = 2; String p1 = "p1"; p.setProperty(field1, f1); p.setProperty(field2, f2.toString()); p.setProperty(property1, p1); BatchProcessParmFactoryImpl impl = new BatchProcessParmFactoryImpl(); Modification<Object> mod = impl.createModification(p, CriteriaDependent.class); SampleCriteriaDependentBean bean = new SampleCriteriaDependentBean(); assertNotNull(mod); mod.execute(bean); Assert.assertEquals(p1, bean.getProperty1()); Assert.assertEquals(f1, bean.getCriteria().getField1()); Assert.assertEquals(f2, bean.getCriteria().getField2()); }
/** Test for createModification() when no additional parameters exist. */ @Test public void testCreateModification_withParams() { Properties p = sample(); String field1 = "field1"; // $NON-NLS-1$ String field2 = "field2"; // $NON-NLS-1$ String v1 = "value1"; // $NON-NLS-1$ Integer v2 = 2; p.setProperty(field1, v1); p.setProperty(field2, v2.toString()); BatchProcessParmFactoryImpl impl = new BatchProcessParmFactoryImpl(); Modification<Object> mod = impl.createModification(p, Object.class); assertNotNull(mod); BeanWith2Fields bean = new BeanWith2Fields(); mod.execute(bean); Assert.assertEquals(v1, bean.getField1()); Assert.assertEquals(v2, bean.getField2()); }