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);  }
@Test(expected = IllegalArgumentException.class) public void test_getDerivedComponentSet_null_componentSetId() throws Exception{ getComponentService().getDerivedComponentSet(null); }
@Test(expected = IllegalArgumentException.class) public void test_getDerivedComponentSet_empty_componentSetId() throws Exception{ getComponentService().getDerivedComponentSet(""); }
@Test(expected = IllegalArgumentException.class) public void test_getDerivedComponentSet_blank_componentSetId() throws Exception{ getComponentService().getDerivedComponentSet(" "); }
@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); }