You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ap...@apache.org on 2007/01/28 17:12:49 UTC
svn commit: r500820 -
/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/HTMLEditorKitTest.java
Author: apetrenko
Date: Sun Jan 28 08:12:48 2007
New Revision: 500820
URL: http://svn.apache.org/viewvc?view=rev&rev=500820
Log:
Unit test for HARMONY-1817 "[classlib][swing] javax.swing.text.html.HTMLEditorKit.createInputAttributes(Element element,MutableAttributeSet set) does not throw NullPointerException when RI does"
Added:
harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/HTMLEditorKitTest.java (with props)
Added: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/HTMLEditorKitTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/HTMLEditorKitTest.java?view=auto&rev=500820
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/HTMLEditorKitTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/HTMLEditorKitTest.java Sun Jan 28 08:12:48 2007
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Aleksey V. Yantsen
+ * @version $Revision$
+ */
+package javax.swing.text.html;
+
+import javax.swing.BasicSwingTestCase;
+import javax.swing.text.Element;
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.SimpleAttributeSet;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import junit.framework.TestCase;
+
+/**
+ * Tests functionality of HTMLEditorKit class.
+ *
+ */
+public class HTMLEditorKitTest extends TestCase {
+
+ class MyHTMLEditorKit extends HTMLEditorKit {
+ public void createInputAttributes(Element element,
+ MutableAttributeSet set) {
+ super.createInputAttributes(element, set);
+ }
+ }
+
+ /**
+ * Check that method throws NPE if element == null
+ */
+ public void testcreateInputAttributes01() {
+ MyHTMLEditorKit kit = new MyHTMLEditorKit();
+ Element element = null;
+ MutableAttributeSet set = new SimpleAttributeSet();
+
+ try {
+ kit.createInputAttributes(element, set);
+ fail("NullPointerException not thrown!");
+ } catch (NullPointerException e) {
+ // expected exception
+ }
+ }
+
+ /**
+ * Check that method throws NPE if set == null
+ */
+ public void testcreateInputAttributes02() {
+ MyHTMLEditorKit kit = new MyHTMLEditorKit();
+ HTMLDocument doc = new HTMLDocument();
+ Element element = doc.getDefaultRootElement();
+ MutableAttributeSet set = null;
+
+ try {
+ kit.createInputAttributes(element, set);
+ fail("NullPointerException not thrown!");
+ } catch (NullPointerException e) {
+ // expected exception
+ }
+ }
+}
\ No newline at end of file
Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/html/HTMLEditorKitTest.java
------------------------------------------------------------------------------
svn:eol-style = native