@Test public void found_edit_block() { Block block = mockBlock(); RequestPageCache cache = mockRequestPageCache(); Page page = mockPage(); BeanBlockContribution contribution = new EditBlockContribution("mydata", "MyPage", "mydisplay"); Collection<BeanBlockContribution> configuration = newList(contribution); train_get(cache, "MyPage", page); train_getBlock(page, "mydisplay", block); replay(); BeanBlockSource source = new BeanBlockSourceImpl(cache, createBeanBlockOverrideSource(cache), configuration); Block actual = source.getEditBlock("MyData"); assertSame(actual, block); verify(); }
public Block getEditBlock(String datatype) { Block result = overrideSource.getEditBlock(datatype); if (result == null) result = masterSource.getEditBlock(datatype); if (result == null) throw new RuntimeException(String.format("There is no defined way to edit data of type '%s'. Make a contribution to the BeanBlockSource service for this type.", datatype)); return result; }
BeanBlockSourceImpl implements BeanBlockSource { public Block getEditBlock(String datatype) { Block result = overrideSource.getEditBlock(datatype); if (result == null) result = masterSource.getEditBlock(datatype); if (result == null) throw new RuntimeException(String.format("There is no defined way to edit data of type '%s'. Make a contribution to the BeanBlockSource service for this type.", datatype)); return result; } }
BeanBlockSourceImpl implements BeanBlockSource { public Block getEditBlock(String datatype) { Block result = overrideSource.getEditBlock(datatype); if (result == null) result = masterSource.getEditBlock(datatype); if (result == null) throw new RuntimeException(String.format("There is no defined way to edit data of type '%s'. Make a contribution to the BeanBlockSource service for this type.", datatype)); return result; } BeanBlockSourceImpl(RequestPageCache pageCache,
                               BeanBlockOverrideSource overrideSource, Collection<BeanBlockContribution> configuration); }
BeanBlockSourceImpl implements BeanBlockSource { public Block getEditBlock(String datatype) { Block result = overrideSource.getEditBlock(datatype); if (result == null) result = masterSource.getEditBlock(datatype); if (result == null) throw new RuntimeException(String.format("There is no defined way to edit data of type '%s'. Make a contribution to the BeanBlockSource service for this type.", datatype)); return result; } BeanBlockSourceImpl(RequestPageCache pageCache,
                               BeanBlockOverrideSource overrideSource, Collection<BeanBlockContribution> configuration); boolean hasDisplayBlock(String datatype); Block getDisplayBlock(String datatype); Block getEditBlock(String datatype); }
BeanBlockSourceImpl implements BeanBlockSource { public Block getEditBlock(String datatype) { Block result = overrideSource.getEditBlock(datatype); if (result == null) result = masterSource.getEditBlock(datatype); if (result == null) throw new RuntimeException(String.format("There is no defined way to edit data of type '%s'. Make a contribution to the BeanBlockSource service for this type.", datatype)); return result; } BeanBlockSourceImpl(RequestPageCache pageCache,
                               BeanBlockOverrideSource overrideSource, Collection<BeanBlockContribution> configuration); boolean hasDisplayBlock(String datatype); Block getDisplayBlock(String datatype); Block getEditBlock(String datatype);  }