### Question:
EntityToDmrBridgeImpl implements EntityToDmrBridge<T> { @Override public void loadEntities(String nameEditedOrAdded) { loadEntities(nameEditedOrAdded, Baseadress.get()); } EntityToDmrBridgeImpl(ApplicationMetaData propertyMetadata, Class<? extends T> type, FrameworkView view,
                                 DispatchAsync dispatcher); @Override T newEntity(); @Override T findEntity(String name); @Override List<T> getEntityList(); @Override String getName(T entity); @Override String getNameOfLastEdited(); @Override void onAdd(T entity); @Override void onEdit(); @Override void onCancel(); @Override void onRemove(T entity); @Override void onSaveDetails(T entity, Map<String, Object> changedValues, ModelNode... extraSteps); @Override void loadEntities(String nameEditedOrAdded); @Override void loadEntities(String nameEditedOrAdded, ModelNode baseAddress);  }### Answer:
@Test public void testLoadEntitiesIncludeRuntime() { TestDispatchAsync testDispatcher = new TestDispatchAsync(); List<PropertyBinding> properties = new ArrayList<PropertyBinding>(); AddressBinding address = new AddressBinding(); address.add("resource", "foo"); BeanMetaData bm = new BeanMetaData(MyNamedEntity.class, address, properties); TestPropertyMetaData pm = new TestPropertyMetaData(); pm.beanMetaData.put(MyNamedEntity.class, bm); EntityToDmrBridgeImpl<MyNamedEntity> bridge = new EntityToDmrBridgeImpl<MyNamedEntity>(pm, MyNamedEntity.class, null, testDispatcher); ModelNode baseAddress = new ModelNode(); baseAddress.set("someroot"); bridge.loadEntities("foobar", baseAddress); DMRAction action = (DMRAction) testDispatcher.lastExecuteAction; ModelNode op = action.getOperation(); Set<String> expectedSet = new HashSet<String>(Arrays.asList(ADDRESS, CHILD_TYPE, OP, INCLUDE_RUNTIME, RECURSIVE)); Assert.assertEquals(expectedSet, op.keys()); Assert.assertEquals("someroot", op.get(ADDRESS).asString()); Assert.assertEquals("resource", op.get(CHILD_TYPE).asString()); Assert.assertEquals("read-children-resources", op.get(OP).asString()); Assert.assertEquals(true, op.get(INCLUDE_RUNTIME).asBoolean()); }
@Test public void testLoadEntitiesRecursive() { TestDispatchAsync testDispatcher = new TestDispatchAsync(); List<PropertyBinding> properties = new ArrayList<PropertyBinding>(); PropertyBinding binding = new PropertyBinding("x", "x/y", "JavaType", false, false); properties.add(binding); AddressBinding address = new AddressBinding(); address.add("resource", "foo"); BeanMetaData bm = new BeanMetaData(MyNamedEntity.class, address, properties); TestPropertyMetaData pm = new TestPropertyMetaData(); pm.beanMetaData.put(MyNamedEntity.class, bm); EntityToDmrBridgeImpl<MyNamedEntity> bridge = new EntityToDmrBridgeImpl<MyNamedEntity>(pm, MyNamedEntity.class, null, testDispatcher); ModelNode baseAddress = new ModelNode(); baseAddress.set("someroot"); bridge.loadEntities("foobar", baseAddress); DMRAction action = (DMRAction) testDispatcher.lastExecuteAction; ModelNode op = action.getOperation(); Set<String> expectedSet = new HashSet<String>(Arrays.asList(ADDRESS, CHILD_TYPE, OP, RECURSIVE, INCLUDE_RUNTIME)); Assert.assertEquals(expectedSet, op.keys()); Assert.assertEquals("someroot", op.get(ADDRESS).asString()); Assert.assertEquals("resource", op.get(CHILD_TYPE).asString()); Assert.assertEquals("read-children-resources", op.get(OP).asString()); Assert.assertEquals(true, op.get(RECURSIVE).asBoolean()); }