@Test(expected = NullPointerException.class) public void calculateHash_NULL() { judgmentEnrichmentTagsHashCalculator.calculateHash(null); }
public String calculateHash(JudgmentEnrichmentTags judgmentEnrichmentTags) { Preconditions.checkNotNull(judgmentEnrichmentTags); if (judgmentEnrichmentTags.getEnrichmentTags().size() == 0) { return null; } String value = judgmentEnrichmentTags.getEnrichmentTags().stream() .sorted(Comparator.comparing(EnrichmentTag::getJudgmentId).thenComparing(EnrichmentTag::getTagType)) .map(tag -> tag.getJudgmentId() + TAG_VALUES_SEPARATOR + tag.getTagType() + TAG_VALUES_SEPARATOR + tag.getValue()) .collect(Collectors.joining(TAG_SEPARATOR)); String hash = DigestUtils.md5Hex(value); return hash; }
JudgmentEnrichmentTagsHashCalculator { public String calculateHash(JudgmentEnrichmentTags judgmentEnrichmentTags) { Preconditions.checkNotNull(judgmentEnrichmentTags); if (judgmentEnrichmentTags.getEnrichmentTags().size() == 0) { return null; } String value = judgmentEnrichmentTags.getEnrichmentTags().stream() .sorted(Comparator.comparing(EnrichmentTag::getJudgmentId).thenComparing(EnrichmentTag::getTagType)) .map(tag -> tag.getJudgmentId() + TAG_VALUES_SEPARATOR + tag.getTagType() + TAG_VALUES_SEPARATOR + tag.getValue()) .collect(Collectors.joining(TAG_SEPARATOR)); String hash = DigestUtils.md5Hex(value); return hash; } }
JudgmentEnrichmentTagsHashCalculator { public String calculateHash(JudgmentEnrichmentTags judgmentEnrichmentTags) { Preconditions.checkNotNull(judgmentEnrichmentTags); if (judgmentEnrichmentTags.getEnrichmentTags().size() == 0) { return null; } String value = judgmentEnrichmentTags.getEnrichmentTags().stream() .sorted(Comparator.comparing(EnrichmentTag::getJudgmentId).thenComparing(EnrichmentTag::getTagType)) .map(tag -> tag.getJudgmentId() + TAG_VALUES_SEPARATOR + tag.getTagType() + TAG_VALUES_SEPARATOR + tag.getValue()) .collect(Collectors.joining(TAG_SEPARATOR)); String hash = DigestUtils.md5Hex(value); return hash; }  }
JudgmentEnrichmentTagsHashCalculator { public String calculateHash(JudgmentEnrichmentTags judgmentEnrichmentTags) { Preconditions.checkNotNull(judgmentEnrichmentTags); if (judgmentEnrichmentTags.getEnrichmentTags().size() == 0) { return null; } String value = judgmentEnrichmentTags.getEnrichmentTags().stream() .sorted(Comparator.comparing(EnrichmentTag::getJudgmentId).thenComparing(EnrichmentTag::getTagType)) .map(tag -> tag.getJudgmentId() + TAG_VALUES_SEPARATOR + tag.getTagType() + TAG_VALUES_SEPARATOR + tag.getValue()) .collect(Collectors.joining(TAG_SEPARATOR)); String hash = DigestUtils.md5Hex(value); return hash; }  String calculateHash(JudgmentEnrichmentTags judgmentEnrichmentTags); }
JudgmentEnrichmentTagsHashCalculator { public String calculateHash(JudgmentEnrichmentTags judgmentEnrichmentTags) { Preconditions.checkNotNull(judgmentEnrichmentTags); if (judgmentEnrichmentTags.getEnrichmentTags().size() == 0) { return null; } String value = judgmentEnrichmentTags.getEnrichmentTags().stream() .sorted(Comparator.comparing(EnrichmentTag::getJudgmentId).thenComparing(EnrichmentTag::getTagType)) .map(tag -> tag.getJudgmentId() + TAG_VALUES_SEPARATOR + tag.getTagType() + TAG_VALUES_SEPARATOR + tag.getValue()) .collect(Collectors.joining(TAG_SEPARATOR)); String hash = DigestUtils.md5Hex(value); return hash; }  String calculateHash(JudgmentEnrichmentTags judgmentEnrichmentTags);  }