### Question:
CalculateService { public static boolean endsWith(Pattern patternValue, String referenceValue, String currentValue) { if (currentValue == null || currentValue.isEmpty()) { return false; } if (patternValue == null) { return currentValue.endsWith(referenceValue); } java.util.regex.Matcher matcher = patternValue.matcher(currentValue); int end = 0; while (matcher.find()) { end = matcher.end(); } return currentValue.length() == end; } private  CalculateService(); static boolean contains(Pattern patternValue, String referenceValue, String currentValue); static boolean equal(Pattern patternValue, String referenceValue, String currentValue); static boolean startsWith(Pattern patternValue, String referenceValue, String currentValue); static boolean endsWith(Pattern patternValue, String referenceValue, String currentValue);  }### Answer:
@Test public void checkSimpleEndsWithOk() { assertThat(CalculateService.endsWith(null, "to", "toto")).isTrue(); }
@Test public void checkSimpleEndsWithReturnsFalseIfCurrentValueIsNull() { assertThat(CalculateService.endsWith(Pattern.compile(".*"), "to", null)).isFalse(); }
@Test public void checkSimpleEndsWithReturnsFalseIfCurrentValueIsEmpty() { assertThat(CalculateService.endsWith(Pattern.compile(".*"), "to", "")).isFalse(); }
@Test public void checkSimpleEndsWithNok() { assertThat(CalculateService.endsWith(null, "la", "la to to")).isFalse(); }
@Test public void checkPatternEndsWithOk() { assertThat(CalculateService.endsWith(Pattern.compile("[to]*"), null, "toto to")).isTrue(); }
@Test public void checkPatternEndsWithNok() { assertThat(CalculateService.endsWith(Pattern.compile("[ta]*]"), null, "ta ta ")).isFalse(); }