@@ -52,7 +52,7 @@ public static void assertBehavesLikeStandardException(Class<? extends Throwable>
52
52
assertMessageCauseConstructorBehavesAsExpected (exceptionClass );
53
53
}
54
54
55
- public static void assertBehavesLikeDebuggableException (Class <? extends DebuggableException > exceptionClass )
55
+ public static void assertBehavesLikeDebuggableException (Class <? extends Throwable > exceptionClass )
56
56
throws Exception {
57
57
assertBehavesLikeStandardException (exceptionClass );
58
58
@@ -126,22 +126,24 @@ private static void assertMessageCauseConstructorBehavesAsExpected(Class<? exten
126
126
//------------------------------------------------------------------------------------------------------------------
127
127
128
128
private static void assertOnlyDebugInformationConstructorBehavesAsExpected (
129
- Class <? extends DebuggableException > exceptionClass ) throws Exception {
130
- DebuggableException exceptionInstance = exceptionClass .getConstructor (DebugInformation .class ).newInstance (
129
+ Class <? extends Throwable > exceptionClass ) throws Exception {
130
+ Throwable exceptionInstance = exceptionClass .getConstructor (DebugInformation .class ).newInstance (
131
131
DEBUG_INFORMATION_REFERENCE );
132
132
133
133
assertExceptionSimilarTo ("only debuginformation" , EXCEPTION_REFERENCE_NO_ARG , exceptionInstance );
134
134
assertCanInitCause (exceptionInstance );
135
- assertTrue ("hasDebugInformation" , exceptionInstance .hasDebugInformation ());
136
- assertSame ("debugInformation" , DEBUG_INFORMATION_REFERENCE , exceptionInstance .getDebugInformation ());
135
+ assertTrue ("instance of DebuggableObject" , exceptionInstance instanceof DebuggableObject );
136
+ DebuggableObject debuggableObject = (DebuggableObject ) exceptionInstance ;
137
+ assertTrue ("hasDebugInformation" , debuggableObject .hasDebugInformation ());
138
+ assertSame ("debugInformation" , DEBUG_INFORMATION_REFERENCE , debuggableObject .getDebugInformation ());
137
139
138
- DebuggableException deserializedInstance = exceptionClass .cast (
140
+ Throwable deserializedInstance = exceptionClass .cast (
139
141
TestSerializationHelper .serializeAndDeserialize (exceptionInstance ));
140
142
assertExceptionEqualTo ("serialization" , exceptionInstance , deserializedInstance );
141
- assertHaveEqualDebugInformation (exceptionInstance , deserializedInstance );
143
+ assertHaveEqualDebugInformation (( DebuggableObject ) exceptionInstance , ( DebuggableObject ) deserializedInstance );
142
144
}
143
145
144
- private static <T extends DebuggableException > void assertDebugInformationCauseConstructorBehavesAsExpected (
146
+ private static <T extends Throwable > void assertDebugInformationCauseConstructorBehavesAsExpected (
145
147
Class <T > exceptionClass ) throws Exception {
146
148
T exceptionInstance = exceptionClass .getConstructor (DebugInformation .class , Throwable .class ).newInstance (
147
149
DEBUG_INFORMATION_REFERENCE , CAUSE_EXCEPTION );
@@ -152,10 +154,10 @@ private static <T extends DebuggableException> void assertDebugInformationCauseC
152
154
T deserializedInstance = exceptionClass .cast (
153
155
TestSerializationHelper .serializeAndDeserialize (exceptionInstance ));
154
156
assertExceptionEqualTo ("serialization" , exceptionInstance , deserializedInstance );
155
- assertHaveEqualDebugInformation (exceptionInstance , deserializedInstance );
157
+ assertHaveEqualDebugInformation (( DebuggableObject ) exceptionInstance , ( DebuggableObject ) deserializedInstance );
156
158
}
157
159
158
- private static <T extends DebuggableException > void assertMessageDebugInformationConstructorBehavesAsExpected (
160
+ private static <T extends Throwable > void assertMessageDebugInformationConstructorBehavesAsExpected (
159
161
Class <T > exceptionClass ) throws Exception {
160
162
T exceptionInstance = exceptionClass .getConstructor (String .class , DebugInformation .class ).newInstance (
161
163
MESSAGE_REFERENCE , DEBUG_INFORMATION_REFERENCE );
@@ -166,10 +168,10 @@ private static <T extends DebuggableException> void assertMessageDebugInformatio
166
168
T deserializedInstance = exceptionClass .cast (
167
169
TestSerializationHelper .serializeAndDeserialize (exceptionInstance ));
168
170
assertExceptionEqualTo ("serialization" , exceptionInstance , deserializedInstance );
169
- assertHaveEqualDebugInformation (exceptionInstance , deserializedInstance );
171
+ assertHaveEqualDebugInformation (( DebuggableObject ) exceptionInstance , ( DebuggableObject ) deserializedInstance );
170
172
}
171
173
172
- private static <T extends DebuggableException > void assertMessageDebugInformationCauseConstructorBehavesAsExpected (
174
+ private static <T extends Throwable > void assertMessageDebugInformationCauseConstructorBehavesAsExpected (
173
175
Class <T > exceptionClass ) throws Exception {
174
176
T exceptionInstance = exceptionClass .getConstructor (String .class , DebugInformation .class ,
175
177
Throwable .class ).newInstance (MESSAGE_REFERENCE , DEBUG_INFORMATION_REFERENCE , CAUSE_EXCEPTION );
@@ -181,7 +183,7 @@ private static <T extends DebuggableException> void assertMessageDebugInformatio
181
183
T deserializedInstance = exceptionClass .cast (
182
184
TestSerializationHelper .serializeAndDeserialize (exceptionInstance ));
183
185
assertExceptionEqualTo ("serialization" , exceptionInstance , deserializedInstance );
184
- assertHaveEqualDebugInformation (exceptionInstance , deserializedInstance );
186
+ assertHaveEqualDebugInformation (( DebuggableObject ) exceptionInstance , ( DebuggableObject ) deserializedInstance );
185
187
}
186
188
187
189
//</editor-fold>
0 commit comments