congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
MatchesFunction
Code IndexAdd Tabnine to your IDE (free)

How to use
MatchesFunction
in
org.kie.dmn.feel.runtime.functions

Best Java code snippets using org.kie.dmn.feel.runtime.functions.MatchesFunction (Showing top 11 results out of 315)

origin: org.kie/kie-dmn-feel

public FEELFnResult<Boolean> invoke(@ParameterName("input") String input, @ParameterName("pattern") String pattern) {
  return invoke( input, pattern, null );
}
origin: org.kie/kie-dmn-feel

@Before
public void setUp() {
  matchesFunction = new MatchesFunction();
}
origin: org.kie/kie-dmn-feel

public FEELFnResult<Boolean> invoke(@ParameterName("input") String input, @ParameterName("pattern") String pattern, @ParameterName("flags") String flags) {
  if ( input == null ) {
    return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "input", "cannot be null" ) );
  }
  if ( pattern == null ) {
    return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "pattern", "cannot be null" ) );
  }
  try {
    int f = processFlags( flags );
    Pattern p = Pattern.compile( pattern, f );
    Matcher m = p.matcher( input );
    return FEELFnResult.ofResult( m.find() );
  } catch ( PatternSyntaxException e ) {
    return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "pattern", "is invalid and can not be compiled", e ) );
  } catch ( IllegalArgumentException t ) {
    return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "flags", "contains unknown flags", t ) );
  } catch ( Throwable t) {
    return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "pattern", "is invalid and can not be compiled", t ) );
  }
}
origin: org.kie/kie-dmn-feel

@Test
public void invokeNull() {
  FunctionTestUtil.assertResultError(matchesFunction.invoke((String) null, null), InvalidParametersEvent.class);
  FunctionTestUtil.assertResultError(matchesFunction.invoke(null, "test"), InvalidParametersEvent.class);
  FunctionTestUtil.assertResultError(matchesFunction.invoke("test", null), InvalidParametersEvent.class);
}
origin: org.kie/kie-dmn-feel

@Test
public void invokeWithoutFlagsNotMatch() {
  FunctionTestUtil.assertResult(matchesFunction.invoke("test", "testt"), false);
  FunctionTestUtil.assertResult(matchesFunction.invoke("foobar", "^fo*bb"), false);
  FunctionTestUtil.assertResult(matchesFunction.invoke("fo\nbar", "fo.bar"), false);
}
origin: org.kie/kie-dmn-feel

@Test
public void invokeWithoutFlagsMatch() {
  FunctionTestUtil.assertResult(matchesFunction.invoke("test", "test"), true);
  FunctionTestUtil.assertResult(matchesFunction.invoke("foobar", "^fo*b"), true);
}
origin: org.kie/kie-dmn-feel

  @Test
  public void invokeWithAllFlags() {
    FunctionTestUtil.assertResult(matchesFunction.invoke("fo\nbar", "Fo.^bar", "smi"), true);
  }
}
origin: org.kie/kie-dmn-feel

@Test
public void invokeWithFlagDotAll() {
  FunctionTestUtil.assertResult(matchesFunction.invoke("fo\nbar", "fo.bar", "s"), true);
}
origin: org.kie/kie-dmn-feel

@Test
public void invokeWithFlagCaseInsensitive() {
  FunctionTestUtil.assertResult(matchesFunction.invoke("foobar", "^Fo*bar", "i"), true);
}
origin: org.kie/kie-dmn-feel

@Test
public void invokeUnsupportedFlags() {
  FunctionTestUtil.assertResult(matchesFunction.invoke("foobar", "fo.bar", "g"), true);
}
origin: org.kie/kie-dmn-feel

@Test
public void invokeWithFlagMultiline() {
  FunctionTestUtil.assertResult(matchesFunction.invoke("fo\nbar", "^bar", "m"), true);
}
org.kie.dmn.feel.runtime.functionsMatchesFunction

Most used methods

  • invoke
  • <init>
  • processFlags

Popular in Java

  • Finding current android device location
  • compareTo (BigDecimal)
  • findViewById (Activity)
  • getResourceAsStream (ClassLoader)
  • String (java.lang)
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • ImageIO (javax.imageio)
  • Notification (javax.management)
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now