ChefPackage { public boolean addProperty(String propertyName, String propertyValue) { Boolean propertyAdded = false; switch (propertyName) { case ChefDslConstants.PACKAGE_NAME_PROPERTY: setPackageName(propertyValue); propertyAdded = true; break; case ChefDslConstants.PACKAGE_VERSION_PROPERTY: setVersion(propertyValue); propertyAdded = true; break; case "action": setAction(propertyValue); propertyAdded = true; break; default: propertyAdded = false; break; } return propertyAdded; } ChefPackage(String name);  ChefPackage(String name, String version);  ChefPackage(ChefPackage chefPackage); String getName(); void setName(String name); String getVersion(); void setVersion(String version); String getPackageName(); String getAction(); void setAction(String action); void setPackageName(String packageName); boolean addProperty(String propertyName, String propertyValue);  }
@Test public void addProperty() { ChefPackage installedPackage = new ChefPackage("openssh-client"); installedPackage.addProperty(ChefDslConstants.PACKAGE_NAME_PROPERTY, "java"); installedPackage.addProperty(ChefDslConstants.PACKAGE_VERSION_PROPERTY, "8"); assertEquals("java", installedPackage.getPackageName()); assertEquals("8", installedPackage.getVersion()); }