MethodTreeUtils { public static boolean isMainMethod(MethodTree m) { return isPublic(m) && isStatic(m) && isNamed(m, "main") && returnsPrimitive(m, "void") && hasStringArrayParameter(m); } private  MethodTreeUtils(); static boolean isMainMethod(MethodTree m); static boolean isEqualsMethod(MethodTree m); static boolean isHashCodeMethod(MethodTree m); static Optional<MethodInvocationTree> consecutiveMethodInvocation(Tree tree); static Optional<MethodInvocationTree> subsequentMethodInvocation(Tree tree, MethodMatchers methodMatchers);  }
@Test void is_main_method() { assertTrue(MethodTreeUtils.isMainMethod(parseMethod("class A { public static void main(String[] args){} }"))); assertTrue(MethodTreeUtils.isMainMethod(parseMethod("class A { public static void main(String... args){} }"))); assertFalse(MethodTreeUtils.isMainMethod(parseMethod("class A { public void main(String[] args){} }"))); assertFalse(MethodTreeUtils.isMainMethod(parseMethod("class A { static void main(String[] args){} }"))); assertFalse(MethodTreeUtils.isMainMethod(parseMethod("class A { public static void amain(String[] args){} }"))); assertFalse(MethodTreeUtils.isMainMethod(parseMethod("class A { public static void main(String args){} }"))); assertFalse(MethodTreeUtils.isMainMethod(parseMethod("class A { public static int main(String[] args){} }"))); assertFalse(MethodTreeUtils.isMainMethod(parseMethod("class A { public static void main(String[] args, String[] second){} }"))); }