1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.apache.harmony.luni.tests.java.util;
18 import java.io.Serializable;
19 import java.util.IllegalFormatWidthException;
21 import junit.framework.TestCase;
23 import org.apache.harmony.testframework.serialization.SerializationTest;
24 import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
26 public class IllegalFormatWidthExceptionTest extends TestCase {
29 * @tests java.util.IllegalFormatWidthException#IllegalFormatWidthException(int)
31 public void test_illegalFormatWidthException() {
32 int width = Integer.MAX_VALUE;
33 IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
35 assertEquals(width, illegalFormatWidthException.getWidth());
40 * @tests java.util.IllegalFormatWidthException#getWidth()
42 public void test_getWidth() {
44 IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
46 assertEquals(width, illegalFormatWidthException.getWidth());
51 * @tests java.util.IllegalFormatWidthException#getMessage()
53 public void test_getMessage() {
55 IllegalFormatWidthException illegalFormatWidthException = new IllegalFormatWidthException(
57 assertTrue(null != illegalFormatWidthException.getMessage());
61 // comparator for IllegalFormatWidthException objects
62 private static final SerializableAssert exComparator = new SerializableAssert() {
63 public void assertDeserialized(Serializable initial,
64 Serializable deserialized) {
66 SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
69 IllegalFormatWidthException initEx = (IllegalFormatWidthException) initial;
70 IllegalFormatWidthException desrEx = (IllegalFormatWidthException) deserialized;
72 assertEquals("Width", initEx.getWidth(), desrEx.getWidth());
77 * @tests serialization/deserialization.
79 public void testSerializationSelf() throws Exception {
81 SerializationTest.verifySelf(new IllegalFormatWidthException(12345),
86 * @tests serialization/deserialization compatibility with RI.
88 public void testSerializationCompatibility() throws Exception {
90 SerializationTest.verifyGolden(this, new IllegalFormatWidthException(
91 12345), exComparator);