/** 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()); }
/** 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()); }
/** Test of setScene method, of class Activity. */ @Test public void testSetScene() { System.out.println("setScene"); // Setup ChildActivity act = new ChildActivity(); VBox vbox = new VBox(); act.setScene(vbox); // Assertion assertEquals(vbox, act.getScene()); }
@Test public void testCreateBroker() { System.out.println("testCreateBroker"); Platform.runLater( new Runnable() { @Override public void run() { synchronized (lock) { // Setup act = new ChildActivity(); act.setScene(new HBox()); Response response = new Response(); response.setStatus(Status.OK); response.setActivity(act); browser.getBrowserPanel().receiveResponse(response); } } }); try { Thread.sleep(100); } catch (InterruptedException ex) { ex.printStackTrace(); } synchronized (lock) { assertNotNull(act.createBroker()); } }