/** * Only delegate to {@link Index#atIndex(int)} so that Assertions offers a full feature entry point to all AssertJ * features (but you can use {@link Index} if you prefer). * <p> * Typical usage : * <pre><code class='java'> List<Ring> elvesRings = newArrayList(vilya, nenya, narya); * assertThat(elvesRings).contains(vilya, atIndex(0)).contains(nenya, atIndex(1)).contains(narya, atIndex(2));</code></pre> * * @param index the value of the index. * @return the created {@code Index}. * @throws IllegalArgumentException if the given value is negative. */ default Index atIndex(final int index) { return Assertions.atIndex(index); }
/** * Only delegate to {@link Index#atIndex(int)} so that Assertions offers a full feature entry point to all AssertJ * features (but you can use {@link Index} if you prefer). * <p> * Typical usage : * <pre><code class='java'> List<Ring> elvesRings = newArrayList(vilya, nenya, narya); * assertThat(elvesRings).contains(vilya, atIndex(0)).contains(nenya, atIndex(1)).contains(narya, atIndex(2));</code></pre> * * @param index the value of the index. * @return the created {@code Index}. * @throws IllegalArgumentException if the given value is negative. */ default Index atIndex(final int index) { return Assertions.atIndex(index); }
/** * Delegate call to {@link org.assertj.core.api.Assertions#atIndex(int)} */ default public Index atIndex(final int actual) { return Assertions.atIndex(actual); }
@Test public void testBoolean() { Boolean[] booleanArray = new Boolean[]{Boolean.FALSE, Boolean.TRUE, Boolean.FALSE}; List<Boolean> booleanList = Arrays.asList(booleanArray); booleanList.sort(comparator); assertThat(booleanList) .contains(Boolean.TRUE, atIndex(0)) .contains(Boolean.FALSE, atIndex(1)) .contains(Boolean.FALSE, atIndex(2)); }
@Test public void testFindAnnotatedMethodsShouldNotShadowedMethodsHavingAnnotation() { // Given: final List<Class<?>> locations = Arrays.<Class<?>>asList(ShadowingTestChild.class); // When: List<Method> result = underTest.findAnnotatedMethods(locations, TestAnnotation.class); // Then: // @formatter:off assertThat(result).hasSize(7) .has(name("privateWithAnnotation"), atIndex(0)) .has(name("notShadowedDueToParameterLength"), atIndex(1)) .has(name("notShadowedDueToParameterTypes"), atIndex(2)) .has(name("shadowed"), atIndex(3)) .has(name("notShadowedDueToParameterLength"), atIndex(4)) .has(name("notShadowedDueToParameterTypes"), atIndex(5)) .has(name("shadowedButChildHasNoAnnotation"), atIndex(6)) ; // @formatter:on }