### Question:
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);  }### Answer:
@Test public void testGetPositionAnnotatedElement() throws Exception { int position = PositionAnnotationReader.getPosition(PosTestPmo.class.getMethod("test")); assertThat(position, is(42)); }
@Test public void testGetPositionAnnotatedElement_SamePosTwice() throws Exception { int position = PositionAnnotationReader.getPosition(PosTestPmo.class.getMethod("testSamePos")); assertThat(position, is(42)); }
@Test public void testGetPositionAnnotatedElement_DiffPos() { Assertions.assertThrows(IllegalArgumentException.class, () -> { PositionAnnotationReader.getPosition(PosTestPmo.class.getMethod("testDiffPos")); }); }
@Test public void testGetPositionAnnotatedElement_BindingDefinition() throws Exception { int position = PositionAnnotationReader.getPosition(PosTestPmo.class.getMethod("testDeprecated")); assertThat(position, is(4711)); }