@Test(timeout = 2000, expected = FieldNotFoundException.class) public void givenAnnotationAndTypeWhenTypeMatchButAnnotationDoesntThenFieldNotFoundExceptionIsThrown() throws Exception { FakeRepositoryWithAnnotation repository = new FakeRepositoryWithAnnotation(); new Asynch(repository).perform(); await().until(fieldIn(repository).ofType(int.class).andAnnotatedWith(ExampleAnnotation2.class), equalTo(1)); assertEquals(1, repository.getValue()); }
@Test(timeout = 2000, expected = FieldNotFoundException.class) public void givenAnnotationAndTypeWhenAnnotationMatchButTypeDoesntThenFieldNotFoundExceptionIsThrown() throws Exception { FakeRepositoryWithAnnotation repository = new FakeRepositoryWithAnnotation(); new Asynch(repository).perform(); byte one = (byte) 1; await().until(fieldIn(repository).ofType(byte.class).andAnnotatedWith(ExampleAnnotation.class), equalTo(one)); assertEquals(1, repository.getValue()); }
@Test(timeout = 2000) public void typeAndAnnotation() throws Exception { FakeRepositoryWithAnnotation repository = new FakeRepositoryWithAnnotation(); new Asynch(repository).perform(); await().until(fieldIn(repository).ofType(int.class).andAnnotatedWith(ExampleAnnotation.class), equalTo(1)); assertEquals(1, repository.getValue()); }
@Test public void showsErrorMessageContainingClassAndTypeAndAnnotationWhenTypeAndAnnotationTypeSpecifiedWhenTimeout() throws Exception { exception.expect(ConditionTimeoutException.class); exception.expectMessage("Field in org.awaitility.classes.FakeRepositoryWithAnnotation annotated with org.awaitility.classes.ExampleAnnotation and of type int expected <1> but was <0> within 200 milliseconds."); FakeRepositoryWithAnnotation repository = new FakeRepositoryWithAnnotation(); new Asynch(repository).perform(); await().atMost(200, MILLISECONDS).until(fieldIn(repository).ofType(int.class).andAnnotatedWith(ExampleAnnotation.class), equalTo(1)); } }
@Test(timeout = 2000, expected = FieldNotFoundException.class) public void givenTypeAndAnnotationAndNameWhenNameAndAnnotationMatchButTypeNotFoundThenFieldNotFoundExceptionIsThrown() throws Exception { FakeRepositoryWithAnnotation repository = new FakeRepositoryWithAnnotation(); new Asynch(repository).perform(); byte one = (byte) 1; await().until(fieldIn(repository).ofType(byte.class).andAnnotatedWith(ExampleAnnotation.class).andWithName("value"), equalTo(one)); assertEquals(1, repository.getValue()); }
@Test(timeout = 2000) public void typeAndAnnotationAndName() throws Exception { FakeRepositoryWithAnnotation repository = new FakeRepositoryWithAnnotation(); new Asynch(repository).perform(); await().until( fieldIn(repository).ofType(int.class).andAnnotatedWith(ExampleAnnotation.class).andWithName("value"), equalTo(1)); assertEquals(1, repository.getValue()); }
@Test(timeout = 2000, expected = FieldNotFoundException.class) public void givenTypeAndAnnotationAndNameWhenNameAndTypeMatchButAnnotationNotFoundThenFieldNotFoundExceptionIsThrown() throws Exception { FakeRepositoryWithAnnotation repository = new FakeRepositoryWithAnnotation(); new Asynch(repository).perform(); await().until( fieldIn(repository).ofType(int.class).andAnnotatedWith(ExampleAnnotation2.class).andWithName("value"), equalTo(1)); assertEquals(1, repository.getValue()); }