### Question:
APICaseVariableAttributeChecker { public void checkUpdateAttributes(Map<String, String> attributes) { if (attributes == null || attributes.isEmpty()) { throw new APIException(format("Attributes '%s' and '%s' must be specified", CaseVariableItem.ATTRIBUTE_TYPE, CaseVariableItem.ATTRIBUTE_VALUE)); } if (!attributes.containsKey(CaseVariableItem.ATTRIBUTE_TYPE)) { throw new APIException(format("Attribute '%s' must be specified", CaseVariableItem.ATTRIBUTE_TYPE)); } if (!attributes.containsKey(CaseVariableItem.ATTRIBUTE_VALUE)) { throw new APIException(format("Attribute '%s' must be specified", CaseVariableItem.ATTRIBUTE_VALUE)); } }  void checkUpdateAttributes(Map<String, String> attributes); void checkSearchFilters(Map<String, String> filters);  }### Answer:
@Test public void checkUpdateAttributesPassForSuitableValues() throws Exception { Map<String, String> attributes = buildSuitableUpdateAttributes(); attributeChecker.checkUpdateAttributes(attributes); }
@Test(expected = APIException.class) public void checkUpdateAttributesCheckForAttributeType() throws Exception { Map<String, String> attributes = buildSuitableUpdateAttributes(); attributes.remove(CaseVariableItem.ATTRIBUTE_TYPE); attributeChecker.checkUpdateAttributes(attributes); }
@Test(expected = APIException.class) public void checkUpdateAttributesCheckForAttributeValue() throws Exception { Map<String, String> attributes = buildSuitableUpdateAttributes(); attributes.remove(CaseVariableItem.ATTRIBUTE_VALUE); attributeChecker.checkUpdateAttributes(attributes); }
@Test(expected = APIException.class) public void should_throw_exception_when_attributes_are_null() throws Exception { attributeChecker.checkUpdateAttributes(null); }