TagHelper { public void validateTagKey(TagKey tagKey) throws IllegalArgumentException { Assert.notNull(tagKey, "A tag key must be specified."); tagKey.setTagTypeCode(alternateKeyHelper.validateStringParameter("tag type code", tagKey.getTagTypeCode())); tagKey.setTagCode(alternateKeyHelper.validateStringParameter("tag code", tagKey.getTagCode())); }  void executeFunctionForTagEntities(final String indexName, final List<TagEntity> tagEntities,
        final TriConsumer<String, String, String> function); String safeObjectMapperWriteValueAsString(final TagEntity tagEntity); void validateTagKey(TagKey tagKey);  }
@Test public void testValidateTagKey() { TagKey tagKey = new TagKey(TAG_TYPE, TAG_CODE); when(alternateKeyHelper.validateStringParameter("tag type code", TAG_TYPE)).thenReturn(TAG_TYPE); when(alternateKeyHelper.validateStringParameter("tag code", TAG_CODE)).thenReturn(TAG_CODE); tagHelper.validateTagKey(tagKey); verify(alternateKeyHelper).validateStringParameter("tag type code", TAG_TYPE); verify(alternateKeyHelper).validateStringParameter("tag code", TAG_CODE); verifyNoMoreInteractions(alternateKeyHelper, jsonHelper); assertEquals(new TagKey(TAG_TYPE, TAG_CODE), tagKey); }
@Test public void testValidateTagKeyTagKeyIsNull() { try { tagHelper.validateTagKey(null); fail(); } catch (IllegalArgumentException e) { assertEquals("A tag key must be specified.", e.getMessage()); } }