@Test public void testValidateComponentNullName() { SW360Component component = new SW360Component(); component.setCategories(Collections.singleton("Antenna")); try { SW360ComponentAdapterUtils.validateComponent(component); fail("Invalid component not detected"); } catch (IllegalArgumentException e) { assertThat(e.getMessage()).contains("missing property 'name'"); } }
static SW360Component validateComponent(SW360Component component) { if (StringUtils.isEmpty(component.getName())) { throw new IllegalArgumentException("Invalid component: missing property 'name'."); } if (component.getCategories() == null || component.getCategories().isEmpty()) { throw new IllegalArgumentException("Invalid component: missing property 'categories'."); } return component; }
SW360ComponentAdapterUtils { static SW360Component validateComponent(SW360Component component) { if (StringUtils.isEmpty(component.getName())) { throw new IllegalArgumentException("Invalid component: missing property 'name'."); } if (component.getCategories() == null || component.getCategories().isEmpty()) { throw new IllegalArgumentException("Invalid component: missing property 'categories'."); } return component; } }
SW360ComponentAdapterUtils { static SW360Component validateComponent(SW360Component component) { if (StringUtils.isEmpty(component.getName())) { throw new IllegalArgumentException("Invalid component: missing property 'name'."); } if (component.getCategories() == null || component.getCategories().isEmpty()) { throw new IllegalArgumentException("Invalid component: missing property 'categories'."); } return component; } private  SW360ComponentAdapterUtils(); }
SW360ComponentAdapterUtils { static SW360Component validateComponent(SW360Component component) { if (StringUtils.isEmpty(component.getName())) { throw new IllegalArgumentException("Invalid component: missing property 'name'."); } if (component.getCategories() == null || component.getCategories().isEmpty()) { throw new IllegalArgumentException("Invalid component: missing property 'categories'."); } return component; } private  SW360ComponentAdapterUtils(); static void setComponentType(SW360Component component, boolean isProprietary); }
SW360ComponentAdapterUtils { static SW360Component validateComponent(SW360Component component) { if (StringUtils.isEmpty(component.getName())) { throw new IllegalArgumentException("Invalid component: missing property 'name'."); } if (component.getCategories() == null || component.getCategories().isEmpty()) { throw new IllegalArgumentException("Invalid component: missing property 'categories'."); } return component; } private  SW360ComponentAdapterUtils(); static void setComponentType(SW360Component component, boolean isProprietary);  }