use of junit.framework.AssertionFailedError in project hibernate-orm by hibernate.
the class QueryRegionImplTest method testQueryUpdate.
@Test
public void testQueryUpdate() throws Exception {
withQueryRegion((sessionFactory, region) -> {
ExceptionHolder holder = new ExceptionHolder();
CyclicBarrier barrier = new CyclicBarrier(2);
withSession(sessionFactory, session -> region.put(session, KEY, VALUE1));
Thread updater = new Thread() {
@Override
public void run() {
try {
withSession(sessionFactory, (session) -> {
assertEquals(VALUE1, region.get(session, KEY));
region.put(session, KEY, VALUE2);
assertEquals(VALUE2, region.get(session, KEY));
barrier.await(5, TimeUnit.SECONDS);
barrier.await(5, TimeUnit.SECONDS);
region.put(session, KEY, VALUE3);
assertEquals(VALUE3, region.get(session, KEY));
barrier.await(5, TimeUnit.SECONDS);
barrier.await(5, TimeUnit.SECONDS);
});
} catch (AssertionFailedError e) {
holder.addAssertionFailure(e);
barrier.reset();
} catch (Exception e) {
holder.addException(e);
barrier.reset();
}
}
};
Thread reader = new Thread() {
@Override
public void run() {
try {
withSession(sessionFactory, (session) -> {
assertEquals(VALUE1, region.get(session, KEY));
barrier.await(5, TimeUnit.SECONDS);
assertEquals(VALUE1, region.get(session, KEY));
barrier.await(5, TimeUnit.SECONDS);
barrier.await(5, TimeUnit.SECONDS);
assertEquals(VALUE1, region.get(session, KEY));
barrier.await(5, TimeUnit.SECONDS);
});
} catch (AssertionFailedError e) {
holder.addAssertionFailure(e);
barrier.reset();
} catch (Exception e) {
holder.addException(e);
barrier.reset();
}
}
};
updater.start();
reader.start();
updater.join();
reader.join();
holder.checkExceptions();
assertEquals(VALUE3, callWithSession(sessionFactory, session -> region.get(session, KEY)));
});
}
use of junit.framework.AssertionFailedError in project junit4 by junit-team.
the class OldTestClassAdaptingListenerTest method addFailureDelegatesToNotifier.
@Test
public void addFailureDelegatesToNotifier() {
Result result = new Result();
RunListener listener = result.createListener();
RunNotifier notifier = new RunNotifier();
notifier.addFirstListener(listener);
TestCase testCase = new TestCase() {
};
TestListener adaptingListener = new JUnit38ClassRunner(testCase).createAdaptingListener(notifier);
adaptingListener.addFailure(testCase, new AssertionFailedError());
assertEquals(1, result.getFailureCount());
}
use of junit.framework.AssertionFailedError in project junit4 by junit-team.
the class AssertionFailedErrorTest method testCreateErrorWithoutMessage.
public void testCreateErrorWithoutMessage() throws Exception {
AssertionFailedError error = new AssertionFailedError();
assertNull(error.getMessage());
}
use of junit.framework.AssertionFailedError in project junit4 by junit-team.
the class AssertionFailedErrorTest method testCreateErrorWithoutMessageInsteadOfNull.
public void testCreateErrorWithoutMessageInsteadOfNull() throws Exception {
AssertionFailedError error = new AssertionFailedError(null);
assertEquals("", error.getMessage());
}
use of junit.framework.AssertionFailedError in project junit4 by junit-team.
the class AssertionFailedErrorTest method testCreateErrorWithMessage.
public void testCreateErrorWithMessage() throws Exception {
AssertionFailedError error = new AssertionFailedError(ARBITRARY_MESSAGE);
assertEquals(ARBITRARY_MESSAGE, error.getMessage());
}
Aggregations