is Test Annotation by regex - Java java.util.regex

Java examples for java.util.regex:Match Word

Description

is Test Annotation by regex

Demo Code


//package com.java2s;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] argv) throws Exception {
        String line = "java2s.com";
        System.out.println(isTestAnnotation(line));
    }/*from w  ww .j a v a2s  .  c  om*/

    public static final Pattern TESTS_PATTERN = Pattern
            .compile("\\s*@Test.*");

    static boolean isTestAnnotation(String line) {
        return TESTS_PATTERN.matcher(line).matches();
    }
}

Related Tutorials