	@Test
	public void testCheckWidgetCalledFromNonMainThread() throws InterruptedException, TimeoutException {

		TestObserver<?> testObserver = getEmptySubscribedTestObserver();

		AtomicBoolean atomic = new AtomicBoolean(false);

		Thread thread = new Thread(() -> {
			boolean checkWidget = Preconditions.checkWidget(testObserver, shell);

			assertThat(checkWidget, is(false));

			testObserver.assertError(IllegalStateException.class);
			testObserver.assertErrorMessage(
					"Expected to be called on the main thread but was " + Thread.currentThread().getName());
			atomic.set(true);
		});
		thread.start();

		await().untilTrue(atomic);
	}