CallChecker { static boolean isCallOf(final String callUnderConsideration, final RunningKeyword keyword) { final String libraryName = keyword.getSourceName(); final String keywordName = keyword.getName(); return QualifiedKeywordName.fromOccurrence(callUnderConsideration) .matchesIgnoringCase(QualifiedKeywordName.create(keywordName, libraryName)) || (EmbeddedKeywordNamesSupport.hasEmbeddedArguments(callUnderConsideration) && EmbeddedKeywordNamesSupport.matchesIgnoreCase(callUnderConsideration, keywordName)); }    }
@Test public void positiveMatchingCallsExamples() { assertThat(CallChecker.isCallOf("log", new RunningKeyword("lib", "log", null))).isTrue(); assertThat(CallChecker.isCallOf("log", new RunningKeyword("lib", "Log", null))).isTrue(); assertThat(CallChecker.isCallOf("lib.Log", new RunningKeyword("lib", "log", null))).isTrue(); assertThat(CallChecker.isCallOf("keyword with ${x} params", new RunningKeyword("lib", "keyword with some params", null))).isTrue(); }
@Test public void negativeMatchingCallsExamples() { assertThat(CallChecker.isCallOf("lag", new RunningKeyword("lib", "log", null))).isFalse(); assertThat(CallChecker.isCallOf("other.Log", new RunningKeyword("lib", "log", null))).isFalse(); assertThat(CallChecker.isCallOf("keyword with ${x:\\d+} params", new RunningKeyword("lib", "keyword with some params", null))).isFalse(); }