ModifiersUtils { public static Optional<ModifierKeywordTree> findModifier(ModifiersTree modifiersTree, Modifier expectedModifier) { return modifiersTree.modifiers().stream() .filter(modifierKeywordTree -> modifierKeywordTree.modifier() == expectedModifier) .findAny(); } private  ModifiersUtils(); static boolean hasModifier(ModifiersTree modifiers, Modifier expectedModifier); @CheckForNull static ModifierKeywordTree getModifier(ModifiersTree modifiers, Modifier expectedModifier); static Optional<ModifierKeywordTree> findModifier(ModifiersTree modifiersTree,  Modifier expectedModifier);  }
@Test void test_find_modifier() { File file = new File("src/test/files/model/ModifiersUtilsTest.java"); CompilationUnitTree tree = JParserTestUtils.parse(file); ClassTree classTree = (ClassTree) tree.types().get(0); assertThat(ModifiersUtils.findModifier(classTree.modifiers(), Modifier.PUBLIC)).isPresent(); assertThat(ModifiersUtils.findModifier(classTree.modifiers(), Modifier.ABSTRACT)).isNotPresent(); }