001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.harmony.jndi.tests.javax.naming;
019:
020: import java.util.Hashtable;
021:
022: import javax.naming.Context;
023: import javax.naming.NamingException;
024: import javax.naming.ReferralException;
025:
026: import org.apache.harmony.jndi.tests.javax.naming.util.Log;
027: import junit.framework.TestCase;
028:
029: public class ReferralExceptionTest extends TestCase {
030:
031: /*
032: * -------------------------------------------------------------------
033: * Constants
034: * -------------------------------------------------------------------
035: */
036:
037: private static final Log log = new Log(ReferralExceptionTest.class);
038:
039: /*
040: * -------------------------------------------------------------------
041: * Constructors
042: * -------------------------------------------------------------------
043: */
044:
045: /**
046: * Constructor for ReferralExceptionTest.
047: *
048: * @param arg0
049: */
050: public ReferralExceptionTest(String arg0) {
051: super (arg0);
052: }
053:
054: /*
055: * -------------------------------------------------------------------
056: * Methods
057: * -------------------------------------------------------------------
058: */
059:
060: public void testAllCoveragePurpose() throws NamingException {
061: log.setMethod("testAllCoveragePurpose()");
062: ReferralException ex = new MockReferralException();
063: ex = new MockReferralException("message");
064:
065: ex.getReferralContext();
066: ex.getReferralContext(null);
067: ex.getReferralInfo();
068: ex.skipReferral();
069: ex.retryReferral();
070: }
071:
072: public static class MockReferralException extends ReferralException {
073:
074: private static final long serialVersionUID = 1L;
075:
076: public MockReferralException() {
077: super ();
078: }
079:
080: public MockReferralException(String s) {
081: super (s);
082: }
083:
084: @Override
085: public Context getReferralContext() throws NamingException {
086: return null;
087: }
088:
089: @Override
090: public Context getReferralContext(Hashtable<?, ?> h)
091: throws NamingException {
092: return null;
093: }
094:
095: @Override
096: public Object getReferralInfo() {
097: return null;
098: }
099:
100: @Override
101: public boolean skipReferral() {
102: return false;
103: }
104:
105: @Override
106: public void retryReferral() {
107:
108: }
109: }
110: }
|