TagDaoHelper { public void validateParentTagType(String tagTypeCode, String parentTagTypeCode) { Assert.isTrue(tagTypeCode.equalsIgnoreCase(parentTagTypeCode), "Tag type code in parent tag key must match the tag type code in the request."); }  void assertDisplayNameDoesNotExistForTag(String tagCode, String displayName); List<TagEntity> getTagChildrenEntities(TagEntity parentTagEntity); TagEntity getTagEntity(TagKey tagKey); void validateParentTagEntity(TagEntity tagEntity, TagEntity parentTagEntity); void validateParentTagType(String tagTypeCode, String parentTagTypeCode);  }
@Test public void testValidateParentTagType() { try { tagDaoHelper.validateParentTagType(TAG_TYPE_CODE, TAG_TYPE_CODE); } catch (IllegalArgumentException illegalArgumentException) { fail("Should not have caught an exception."); } }
@Test public void testValidateParentTagTypeWithUnmatchedTagTypeCode() { try { tagDaoHelper.validateParentTagType(TAG_TYPE_CODE, TAG_TYPE_CODE_2); fail("Expected to throw an exception."); } catch (IllegalArgumentException illegalArgumentException) { assertThat("Exception message is not correct.", illegalArgumentException.getMessage(), is(equalTo("Tag type code in parent tag key must match the tag type code in the request."))); } }