### Question:
DefaultEnrichmentTagApplier implements EnrichmentTagApplier { @Override public void applyEnrichmentTag(Judgment judgment, EnrichmentTag enrichmentTag) { Preconditions.checkNotNull(judgment); Preconditions.checkNotNull(enrichmentTag); Preconditions.checkArgument(handlesEnrichmentTagType(enrichmentTag.getTagType())); TAG_VALUE enrichmentTagValue; try { enrichmentTagValue = jsonStringParser.parseAndValidate(enrichmentTag.getValue()); } catch (JsonParseException e) { throw new IllegalArgumentException(e); } MODEL_OBJECT modelObject = enrichmentTagValueConverter.convert(enrichmentTagValue); judgmentUpdater.addToJudgment(judgment, modelObject); } DefaultEnrichmentTagApplier(String handledEnrichmentTagType); @Override void applyEnrichmentTag(Judgment judgment, EnrichmentTag enrichmentTag); @Override boolean handlesEnrichmentTagType(String enrichmentTagType); void setJsonStringParser(JsonStringParser<TAG_VALUE> jsonStringParser); void setEnrichmentTagValueConverter(EnrichmentTagValueConverter<TAG_VALUE, MODEL_OBJECT> enrichmentTagValueConverter); void setJudgmentUpdater(JudgmentUpdater<MODEL_OBJECT> judgmentUpdater);  }### Answer:
@Test public void applyEnrichmentTag_NotHandledTagType() { when(enrichmentTag.getTagType()).thenReturn("ABC"); catchException(defaultEnrichmentTagApplier).applyEnrichmentTag(judgment, enrichmentTag); assertTrue(caughtException() instanceof IllegalArgumentException); verifyZeroInteractions(enrichmentTagValueConverter, jsonStringParser, judgmentUpdater); }
@Test public void applyEnrichmentTag_NullJudgment() { catchException(defaultEnrichmentTagApplier).applyEnrichmentTag(null, enrichmentTag); assertTrue(caughtException() instanceof NullPointerException); verifyZeroInteractions(enrichmentTagValueConverter, jsonStringParser, judgmentUpdater); }
@Test public void applyEnrichmentTag_NullEnrichmentTag() { catchException(defaultEnrichmentTagApplier).applyEnrichmentTag(judgment, null); assertTrue(caughtException() instanceof NullPointerException); verifyZeroInteractions(enrichmentTagValueConverter, jsonStringParser, judgmentUpdater); }
@Test public void applyEnrichmentTag_JsonParseEx() throws Exception { when(jsonStringParser.parseAndValidate(Mockito.anyString())).thenThrow(new IllegalArgumentException()); catchException(defaultEnrichmentTagApplier).applyEnrichmentTag(judgment, enrichmentTag); assertTrue(caughtException() instanceof IllegalArgumentException); verify(jsonStringParser).parseAndValidate(enrichmentTag.getValue()); verifyZeroInteractions(enrichmentTagValueConverter, judgmentUpdater); }
@Test public void applyEnrichmentTag() throws Exception { String tagValueObject = "YYY"; Object modelObject = mock(Object.class); when(enrichmentTag.getValue()).thenReturn(tagValueObject); when(jsonStringParser.parseAndValidate(enrichmentTag.getValue())).thenReturn(tagValueObject); when(enrichmentTagValueConverter.convert(tagValueObject)).thenReturn(modelObject); defaultEnrichmentTagApplier.applyEnrichmentTag(judgment, enrichmentTag); verify(jsonStringParser).parseAndValidate(tagValueObject); verify(enrichmentTagValueConverter).convert(tagValueObject); verify(judgmentUpdater).addToJudgment(judgment, modelObject); verifyNoMoreInteractions(jsonStringParser, enrichmentTagValueConverter, judgmentUpdater); }