harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ghar...@apache.org
Subject svn commit: r407755 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/ test/java/tests/api/java/util/ test/resources/serialization/java/util/
Date Fri, 19 May 2006 09:27:39 GMT
Author: gharley
Date: Fri May 19 02:27:38 2006
New Revision: 407755

URL: http://svn.apache.org/viewvc?rev=407755&view=rev
Log:
HARMONY 476 : Java 5 Enhancement:new class java.util.InputMismatchException

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/InputMismatchException.java
  (with props)
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/InputMismatchExceptionTest.java
  (with props)
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/InputMismatchExceptionTest.ser
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AllTests.java

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/InputMismatchException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/InputMismatchException.java?rev=407755&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/InputMismatchException.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/InputMismatchException.java
Fri May 19 02:27:38 2006
@@ -0,0 +1,47 @@
+/* Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+package java.util;
+
+import java.io.Serializable;
+
+/**
+ * An InputMismatchException is thrown by a scanner to indicate that the next
+ * token does not match the pattern the specified type.
+ * 
+ * @see Scanner
+ */
+public class InputMismatchException extends NoSuchElementException implements
+		Serializable {
+
+	static final long serialVersionUID = 8811230760997066428L;
+	
+	/**
+	 * Constructs a InputMismatchException with no error message
+	 * 
+	 */
+	public InputMismatchException() {
+		super();
+	}
+
+	/**
+	 * Constructs a InputMismatchException with msg as its error message
+	 * 
+	 * @param msg
+	 *            The specified error message
+	 */
+	public InputMismatchException(String msg) {
+		super(msg);
+	}
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/InputMismatchException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AllTests.java?rev=407755&r1=407754&r2=407755&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AllTests.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/AllTests.java
Fri May 19 02:27:38 2006
@@ -61,6 +61,7 @@
 		suite.addTestSuite(IllegalFormatFlagsExceptionTest.class);
 		suite.addTestSuite(IllegalFormatPrecisionExceptionTest.class);
 		suite.addTestSuite(IllegalFormatWidthExceptionTest.class);
+        suite.addTestSuite(InputMismatchExceptionTest.class);
 		suite.addTestSuite(LinkedHashMapTest.class);
 		suite.addTestSuite(LinkedHashSetTest.class);
 		suite.addTestSuite(LinkedListTest.class);

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/InputMismatchExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/InputMismatchExceptionTest.java?rev=407755&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/InputMismatchExceptionTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/InputMismatchExceptionTest.java
Fri May 19 02:27:38 2006
@@ -0,0 +1,71 @@
+/* Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+package tests.api.java.util;
+
+import java.io.Serializable;
+import java.util.InputMismatchException;
+import java.util.NoSuchElementException;
+
+import tests.util.SerializationTester;
+
+import junit.framework.TestCase;
+
+public class InputMismatchExceptionTest extends TestCase {
+
+	private static final String SERIALIZATION_FILE_NAME = "serialization/java/util/InputMismatchExceptionTest.ser";
//$NON-NLS-1$
+
+	private static final String ERROR_MESSAGE = "for serialization test"; //$NON-NLS-1$
+
+	/**
+	 * @tests java.util.InputMismatchException#InputMismatchException()
+	 */
+	public void test_Constructor() {
+		InputMismatchException exception = new InputMismatchException();
+		assertNotNull(exception);
+		assertTrue(exception instanceof NoSuchElementException);
+		assertTrue(exception instanceof Serializable);
+	}
+
+	/**
+	 * @tests java.util.InputMismatchException#InputMismatchException(String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		InputMismatchException exception = new InputMismatchException(ERROR_MESSAGE);
+		assertNotNull(exception);
+		assertEquals(ERROR_MESSAGE, exception.getMessage());
+	}
+
+	/**
+	 * @tests serialization/deserilazation.
+	 */
+	public void testSerialization() throws Exception {
+		InputMismatchException exception = new InputMismatchException(ERROR_MESSAGE);
+		InputMismatchException deserialedException = (InputMismatchException) SerializationTester
+				.getDeserilizedObject(exception);
+		assertEquals(exception.getMessage(), deserialedException.getMessage());
+		assertEquals(exception.getCause(), deserialedException.getCause());
+	}
+
+	/**
+	 * @tests serialization/deserilazation compatibility with RI.
+	 */
+	public void testSerializationCompatibility() throws Exception {
+		InputMismatchException exception = new InputMismatchException(ERROR_MESSAGE);
+		InputMismatchException deserialedException = (InputMismatchException) SerializationTester
+				.readObject(exception, SERIALIZATION_FILE_NAME);
+		assertEquals(deserialedException.getMessage(), exception.getMessage());
+		assertEquals(deserialedException.getCause(), exception.getCause());
+	}
+}
\ No newline at end of file

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/InputMismatchExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/InputMismatchExceptionTest.ser
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/InputMismatchExceptionTest.ser?rev=407755&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/resources/serialization/java/util/InputMismatchExceptionTest.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message