01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14: * License for the specific language governing permissions and limitations under
15: * the License.
16: */
17:
18: package org.apache.harmony.luni.tests.java.net;
19:
20: import java.io.Serializable;
21: import java.net.HttpRetryException;
22:
23: import junit.framework.TestCase;
24:
25: import org.apache.harmony.testframework.serialization.SerializationTest;
26: import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
27:
28: public class HttpRetryExceptionTest extends TestCase {
29:
30: private static final String LOCATION = "Http test"; //$NON-NLS-1$
31:
32: private static final String DETAIL = "detail"; //$NON-NLS-1$
33:
34: // comparator for HttpRetryException objects
35: private static final SerializableAssert comparator = new SerializableAssert() {
36: public void assertDeserialized(Serializable reference,
37: Serializable test) {
38:
39: HttpRetryException ref = (HttpRetryException) reference;
40: HttpRetryException tst = (HttpRetryException) test;
41:
42: assertEquals("getLocation", ref.getLocation(), tst
43: .getLocation());
44: assertEquals("responseCode", ref.responseCode(), tst
45: .responseCode());
46: assertEquals("getReason", ref.getReason(), tst.getReason());
47: assertEquals("getMessage", ref.getMessage(), tst
48: .getMessage());
49: }
50: };
51:
52: /**
53: * @tests serialization/deserialization.
54: */
55: public void testSerializationSelf() throws Exception {
56: SerializationTest.verifySelf(new HttpRetryException(DETAIL,
57: 100, LOCATION), comparator);
58: }
59:
60: /**
61: * @tests serialization/deserialization compatibility with RI.
62: */
63: public void testSerializationCompatibility() throws Exception {
64: SerializationTest.verifyGolden(this , new HttpRetryException(
65: DETAIL, 100, LOCATION), comparator);
66: }
67: }
|