Program: 155555
Project: 155555
Buggy source:
@Test public void callThreadConfinedMethodsFromWrongThread() throws Throwable {
  dynamicRealm.beginTransaction();
  dynamicRealm.deleteAll();
  final DynamicRealmObject obj=dynamicRealm.createObject(AllJavaTypes.CLASS_NAME,100L);
  dynamicRealm.commitTransaction();
  final AtomicReference<Throwable> throwableFromThread=new AtomicReference<Throwable>();
  final CountDownLatch testFinished=new CountDownLatch(1);
  final String expectedMessage;
  try {
    final Field expectedMessageField=BaseRealm.class.getDeclaredField("String_Node_Str");
    expectedMessageField.setAccessible(true);
    expectedMessage=(String)expectedMessageField.get(null);
  }
 catch (  NoSuchFieldException e) {
    throw new AssertionError(e);
  }
catch (  IllegalAccessException e) {
    throw new AssertionError(e);
  }
  final Thread thread=new Thread("String_Node_Str"){
    @Override public void run(){
      try {
        for (        ThreadConfinedMethods method : ThreadConfinedMethods.values()) {
          try {
            callThreadConfinedMethod(obj,method);
            fail("String_Node_Str");
          }
 catch (          Throwable e) {
            if (e instanceof IllegalStateException && expectedMessage.equals(e.getMessage())) {
              continue;
            }
            throwableFromThread.set(e);
            return;
          }
        }
      }
  finally {
        testFinished.countDown();
      }
    }
  }
;
  thread.start();
  TestHelper.awaitOrFail(testFinished);
  final Throwable throwable=throwableFromThread.get();
  if (throwable != null) {
    throw throwable;
  }
}

Fixed version (ground truth):
@Test public void callThreadConfinedMethodsFromWrongThread() throws Throwable {
  dynamicRealm.beginTransaction();
  dynamicRealm.deleteAll();
  final DynamicRealmObject obj=dynamicRealm.createObject(AllJavaTypes.CLASS_NAME,100L);
  dynamicRealm.commitTransaction();
  final AtomicReference<Throwable> throwableFromThread=new AtomicReference<Throwable>();
  final CountDownLatch testFinished=new CountDownLatch(1);
  final String expectedMessage;
  try {
    final Field expectedMessageField=BaseRealm.class.getDeclaredField("String_Node_Str");
    expectedMessageField.setAccessible(true);
    expectedMessage=(String)expectedMessageField.get(null);
  }
 catch (  NoSuchFieldException e) {
    throw new AssertionError(e);
  }
catch (  IllegalAccessException e) {
    throw new AssertionError(e);
  }
  final Thread thread=new Thread("String_Node_Str"){
    @Override public void run(){
      try {
        for (        ThreadConfinedMethods method : ThreadConfinedMethods.values()) {
          try {
            callThreadConfinedMethod(obj,method);
            fail("String_Node_Str");
          }
 catch (          IllegalStateException e) {
            if (expectedMessage.equals(e.getMessage())) {
              continue;
            }
            throwableFromThread.set(e);
            return;
          }
        }
      }
  finally {
        testFinished.countDown();
      }
    }
  }
;
  thread.start();
  TestHelper.awaitOrFail(testFinished);
  final Throwable throwable=throwableFromThread.get();
  if (throwable != null) {
    throw throwable;
  }
}