code: public static boolean isRunningInExpectedThread(@Nullable Thread expected) {
  		Thread actual = Thread.currentThread();
  		if (expected != actual) {
  
  			String violationMsg = "Violation of main thread constraint detected: expected <"
  				+ expected + "> but running in <" + actual + ">.";
  
  			LOG.warn(violationMsg, new Exception(violationMsg));
  
  			return false;
  		}
  
  		return true;
  	}
docs: Returns true iff the current thread is equals to the provided expected thread and logs violations.
  
  @param expected the expected main thread.
  @return true iff the current thread is equals to the provided expected thread.