KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > remoting > support > RemoteInvocationUtilsTests


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */

16
17 package org.springframework.remoting.support;
18
19 import junit.framework.TestCase;
20 import org.springframework.core.JdkVersion;
21
22 /**
23  * Unit tests for the {@link RemoteInvocationUtils} class.
24  *
25  * @author Rick Evans
26  */

27 public final class RemoteInvocationUtilsTests extends TestCase {
28
29     public void testFillInClientStackTraceIfPossibleSunnyDay() throws Exception JavaDoc {
30         if (!JdkVersion.isAtLeastJava14()) {
31             return;
32         }
33         try {
34             throw new IllegalStateException JavaDoc("Mmm");
35         } catch (Exception JavaDoc ex) {
36             int originalStackTraceLngth = ex.getStackTrace().length;
37             RemoteInvocationUtils.fillInClientStackTraceIfPossible(ex);
38             assertTrue("Stack trace not being filled in",
39                     ex.getStackTrace().length > originalStackTraceLngth);
40         }
41     }
42
43     public void testFillInClientStackTraceIfPossibleWithNullThrowable() throws Exception JavaDoc {
44         if (!JdkVersion.isAtLeastJava14()) {
45             return;
46         }
47         // just want to ensure that it doesn't bomb
48
RemoteInvocationUtils.fillInClientStackTraceIfPossible(null);
49     }
50
51 }
52
Popular Tags