@Test public void edit_block_not_found() { RequestPageCache cache = mockRequestPageCache(); Collection<BeanBlockContribution> configuration = newList(); replay(); BeanBlockSource source = new BeanBlockSourceImpl(cache, createBeanBlockOverrideSource(cache), configuration); try { source.getEditBlock("MyData"); unreachable(); } catch (RuntimeException ex) { assertEquals( ex.getMessage(), "There is no defined way to edit data of type \'MyData\'. Make a contribution to the BeanBlockSource service for this type."); } 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);  }