Example #1
0
 /** Test of initialize method, of class Activity. */
 @Test
 public void testInitialize_Activity_Map() throws Exception {
   System.out.println("initialize");
   // Setup
   ParentActivity parent = new ParentActivity();
   Data data = new Data();
   Map<Field, Object> fieldParams = new HashMap<Field, Object>();
   for (Field field : data.getClass().getDeclaredFields()) {
     field.setAccessible(true);
     fieldParams.put(field, field.get(data));
   }
   final String field2 = "field2value";
   final List<String> field3 = new ArrayList<String>();
   Map<String, Object> takeoverParams =
       new HashMap<String, Object>() {
         {
           put("field2", field2);
           put("field3", field3);
         }
       };
   ChildActivity child = new ChildActivity();
   child.initialize(parent, fieldParams, takeoverParams);
   // Assertion
   assertEquals(parent, child.getParent());
   assertEquals(data.getField0(), child.field0);
   assertEquals(data.getField1(), child.field1);
   assertEquals(field2, child.field2);
   assertEquals(field3, child.field3);
   assertEquals("TESTING", child.getTest());
 }
Example #2
0
 /** Test of initialize method, of class Activity. */
 @Test
 public void testInitialize_0args() {
   System.out.println("initialize");
   // Setup
   ChildActivity act = new ChildActivity();
   act.initialize();
   // Assertion
   assertEquals("TESTING", act.getTest());
 }