AllowedOperation { public boolean isOperationAllowedOn(String opItemType, String opItemValue, MatchType matchType) { if (this.items == null || this.items.isEmpty()) { return true; } if (opItemType == null || opItemValue == null) { return false; } opItemType = opItemType.toLowerCase(); opItemValue = opItemValue.toLowerCase(); Set<String> opItems = this.items.get(opItemType); if (opItems == null) { return false; } boolean result = false; switch (matchType) { case EQUALS: result = opItems.contains(opItemValue); break; case STARTS_WITH: for (String value : opItems) { if (opItemValue.startsWith(value)) { result = true; break; } } break; } return result; }  Map<String, Set<String>> getItems(); void setItems(Map<String, Set<String>> items); String getName(); void setName(String name); boolean isOperationAllowedOn(String opItemType, String opItemValue, MatchType matchType); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testIsOperationAllowedOnNoItems() { AllowedOperation op = new AllowedOperation(); assertTrue(op.isOperationAllowedOn("opItemType", "opItemValue", AllowedOperation.MatchType.EQUALS)); }