jdk/test/java/awt/AlphaComposite/TestAlphaCompositeForNaN.java
changeset 4955 e99245ecb5b2
child 21596 0e3a39f29dbc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/AlphaComposite/TestAlphaCompositeForNaN.java	Mon Mar 08 11:35:30 2010 -0800
@@ -0,0 +1,22 @@
+/*
+ * @test
+ * @bug 6918065
+ * @summary Test for passing NaN as alpha
+ *          should throw IllegalArgumentException
+ */
+
+import java.awt.*;
+
+public class TestAlphaCompositeForNaN {
+  public static void main(String[] args) {
+    try {
+      AlphaComposite a = AlphaComposite.getInstance(AlphaComposite.DST, Float.NaN);
+      System.out.println("Failed");
+      throw new RuntimeException(a + " failed to throw IllegalArgumentException for alpha = " + Float.NaN);
+    }
+    catch (IllegalArgumentException ie) {
+      System.out.println("Passed");
+      System.out.println("Caught " + ie);
+    }
+  }
+}