Java examples for java.util.regex:Match Word
is Test Annotation by regex
//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(); } }