@Test public void testGetPositionAnnotatedElement_DiffPos() { Assertions.assertThrows(IllegalArgumentException.class, () -> { PositionAnnotationReader.getPosition(PosTestPmo.class.getMethod("testDiffPos")); }); }
public static int getPosition(AnnotatedElement element) { return Arrays.stream(element.getAnnotations()) .filter(a -> a.annotationType().isAnnotationPresent(LinkkiPositioned.class)) .map(PositionAnnotationReader::getPosition) .reduce((a, b) -> verifySamePosition(element, a, b)) .orElseGet(() -> getDeprecatedPosition(element)); }
PositionAnnotationReader { public static int getPosition(AnnotatedElement element) { return Arrays.stream(element.getAnnotations()) .filter(a -> a.annotationType().isAnnotationPresent(LinkkiPositioned.class)) .map(PositionAnnotationReader::getPosition) .reduce((a, b) -> verifySamePosition(element, a, b)) .orElseGet(() -> getDeprecatedPosition(element)); } }
PositionAnnotationReader { public static int getPosition(AnnotatedElement element) { return Arrays.stream(element.getAnnotations()) .filter(a -> a.annotationType().isAnnotationPresent(LinkkiPositioned.class)) .map(PositionAnnotationReader::getPosition) .reduce((a, b) -> verifySamePosition(element, a, b)) .orElseGet(() -> getDeprecatedPosition(element)); } private  PositionAnnotationReader(); }
PositionAnnotationReader { public static int getPosition(AnnotatedElement element) { return Arrays.stream(element.getAnnotations()) .filter(a -> a.annotationType().isAnnotationPresent(LinkkiPositioned.class)) .map(PositionAnnotationReader::getPosition) .reduce((a, b) -> verifySamePosition(element, a, b)) .orElseGet(() -> getDeprecatedPosition(element)); } private  PositionAnnotationReader(); static int getPosition(AnnotatedElement element); static int getPosition(Annotation annotation); }
PositionAnnotationReader { public static int getPosition(AnnotatedElement element) { return Arrays.stream(element.getAnnotations()) .filter(a -> a.annotationType().isAnnotationPresent(LinkkiPositioned.class)) .map(PositionAnnotationReader::getPosition) .reduce((a, b) -> verifySamePosition(element, a, b)) .orElseGet(() -> getDeprecatedPosition(element)); } private  PositionAnnotationReader(); static int getPosition(AnnotatedElement element); static int getPosition(Annotation annotation);  }