@Test public void test_getDerivedComponentSet_not_exists() throws Exception{ when(dataObjectService.findMatching(Matchers.argThat( new ClassOrSubclassMatcher<DerivedComponentBo>(DerivedComponentBo.class)), any(QueryByCriteria.class))).thenReturn(null); List<Component> components = getComponentService().getDerivedComponentSet("blah"); assertTrue("getDerivedComponentSet is empty",components != null && components.isEmpty()); assertImmutableList(components); }
@Override public List<Component> getDerivedComponentSet(String componentSetId) { if (StringUtils.isBlank(componentSetId)) { throw new RiceIllegalArgumentException("componentSetId was a null or blank value"); } Map<String, Object> criteria = new HashMap<String, Object>(); criteria.put("componentSetId", componentSetId); QueryResults<DerivedComponentBo> derivedComponentBos = getDataObjectService().findMatching(DerivedComponentBo.class, QueryByCriteria.Builder.andAttributes(criteria).build()); return translateCollections(null, derivedComponentBos); }
ComponentServiceImpl implements ComponentService { @Override public List<Component> getDerivedComponentSet(String componentSetId) { if (StringUtils.isBlank(componentSetId)) { throw new RiceIllegalArgumentException("componentSetId was a null or blank value"); } Map<String, Object> criteria = new HashMap<String, Object>(); criteria.put("componentSetId", componentSetId); QueryResults<DerivedComponentBo> derivedComponentBos = getDataObjectService().findMatching(DerivedComponentBo.class, QueryByCriteria.Builder.andAttributes(criteria).build()); return translateCollections(null, derivedComponentBos); } }
ComponentServiceImpl implements ComponentService { @Override public List<Component> getDerivedComponentSet(String componentSetId) { if (StringUtils.isBlank(componentSetId)) { throw new RiceIllegalArgumentException("componentSetId was a null or blank value"); } Map<String, Object> criteria = new HashMap<String, Object>(); criteria.put("componentSetId", componentSetId); QueryResults<DerivedComponentBo> derivedComponentBos = getDataObjectService().findMatching(DerivedComponentBo.class, QueryByCriteria.Builder.andAttributes(criteria).build()); return translateCollections(null, derivedComponentBos); }  }
ComponentServiceImpl implements ComponentService { @Override public List<Component> getDerivedComponentSet(String componentSetId) { if (StringUtils.isBlank(componentSetId)) { throw new RiceIllegalArgumentException("componentSetId was a null or blank value"); } Map<String, Object> criteria = new HashMap<String, Object>(); criteria.put("componentSetId", componentSetId); QueryResults<DerivedComponentBo> derivedComponentBos = getDataObjectService().findMatching(DerivedComponentBo.class, QueryByCriteria.Builder.andAttributes(criteria).build()); return translateCollections(null, derivedComponentBos); }  @Override Component getComponentByCode(String namespaceCode, String componentCode); @Override List<Component> getAllComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getActiveComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getDerivedComponentSet(String componentSetId); @Override @Transactional void publishDerivedComponents(String componentSetId, List<Component> components); ComponentSetDao getComponentSetDao(); void setComponentSetDao(ComponentSetDao componentSetDao); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService); }
ComponentServiceImpl implements ComponentService { @Override public List<Component> getDerivedComponentSet(String componentSetId) { if (StringUtils.isBlank(componentSetId)) { throw new RiceIllegalArgumentException("componentSetId was a null or blank value"); } Map<String, Object> criteria = new HashMap<String, Object>(); criteria.put("componentSetId", componentSetId); QueryResults<DerivedComponentBo> derivedComponentBos = getDataObjectService().findMatching(DerivedComponentBo.class, QueryByCriteria.Builder.andAttributes(criteria).build()); return translateCollections(null, derivedComponentBos); }  @Override Component getComponentByCode(String namespaceCode, String componentCode); @Override List<Component> getAllComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getActiveComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getDerivedComponentSet(String componentSetId); @Override @Transactional void publishDerivedComponents(String componentSetId, List<Component> components); ComponentSetDao getComponentSetDao(); void setComponentSetDao(ComponentSetDao componentSetDao); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService);  }