--- jsr166/src/test/tck/AtomicReferenceFieldUpdaterTest.java 2013/04/01 20:58:58 1.26 +++ jsr166/src/test/tck/AtomicReferenceFieldUpdaterTest.java 2013/05/30 03:28:55 1.29 @@ -13,6 +13,7 @@ public class AtomicReferenceFieldUpdater volatile Integer x = null; Object z; Integer w; + volatile int i; public static void main(String[] args) { junit.textui.TestRunner.run(suite()); @@ -33,27 +34,39 @@ public class AtomicReferenceFieldUpdater try { updaterFor("y"); shouldThrow(); - } catch (RuntimeException success) {} + } catch (RuntimeException success) { + assertNotNull(success.getCause()); + } } /** - * construction with field not of given type throws RuntimeException + * construction with field not of given type throws ClassCastException */ public void testConstructor2() { try { updaterFor("z"); shouldThrow(); - } catch (RuntimeException success) {} + } catch (ClassCastException success) {} } /** - * Constructor with non-volatile field throws exception + * Constructor with non-volatile field throws IllegalArgumentException */ public void testConstructor3() { try { updaterFor("w"); shouldThrow(); - } catch (RuntimeException success) {} + } catch (IllegalArgumentException success) {} + } + + /** + * Constructor with non-reference field throws ClassCastException + */ + public void testConstructor4() { + try { + updaterFor("i"); + shouldThrow(); + } catch (ClassCastException success) {} } /**