This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: New test for AttributeSet
- From: Anthony Balkissoon <abalkiss at redhat dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Wed, 21 Dec 2005 15:16:27 -0500
- Subject: FYI: New test for AttributeSet
This tests the isEqual method in 2 AttributeSet implementations to see
how they handle null arguments.
2005-12-20 Anthony Balkissoon <abalkiss@redhat.com>
* gnu/testlet/javax/swing/text/AttributeSet: New directory.
* gnu/testlet/javax/swing/text/AttributeSet/isEqual.java: New test.
--Tony
Index: gnu/testlet/javax/swing/text/AttributeSet/isEqual.java
===================================================================
RCS file: gnu/testlet/javax/swing/text/AttributeSet/isEqual.java
diff -N gnu/testlet/javax/swing/text/AttributeSet/isEqual.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/text/AttributeSet/isEqual.java 21 Dec 2005 20:14:35 -0000
@@ -0,0 +1,69 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 Red Hat.
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.text.AttributeSet;
+
+import javax.swing.text.AttributeSet;
+import javax.swing.text.SimpleAttributeSet;
+import javax.swing.text.StyleContext;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class isEqual extends StyleContext implements Testlet
+{
+ /**
+ * Starts the test run.
+ *
+ * @param harness the test harness to use
+ */
+ public void test(TestHarness harness)
+ {
+ boolean caught = false;
+ SimpleAttributeSet set1 = new SimpleAttributeSet();
+ StyleContext.SmallAttributeSet set2 = createSmallAttributeSet(set1);
+
+ try
+ {
+ set1.isEqual(null);
+ }
+ catch (NullPointerException npe)
+ {
+ caught = true;
+ }
+
+ harness.check(caught);
+ caught = false;
+
+ try
+ {
+ set2.isEqual(null);
+ }
+ catch (NullPointerException npe)
+ {
+ caught = true;
+ }
+ harness.check (caught);
+
+ harness.check (set2.isEqual(set1));
+ harness.check (set1.isEqual(set2));
+ }
+}