-
Notifications
You must be signed in to change notification settings - Fork 113
/
java_exception_test.go
124 lines (119 loc) · 8.11 KB
/
java_exception_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package hessian
import (
"testing"
)
import (
"github.com/stretchr/testify/assert"
)
func TestException(t *testing.T) {
doTestException(t, "throw_throwable", "exception")
doTestException(t, "throw_exception", "exception")
doTestException(t, "throw_MalformedParameterizedTypeException", "MalformedParameterizedType")
doTestException(t, "throw_MalformedParametersException", "MalformedParametersException")
doTestException(t, "throw_TypeNotPresentException", "Type exceptiontype1 not present")
doTestException(t, "throw_WrongMethodTypeException", "WrongMethodTypeException")
doTestException(t, "throw_UndeclaredThrowableException", "UndeclaredThrowableException")
doTestException(t, "throw_runtimeException", "runtimeException")
doTestException(t, "throw_arrayStoreException", "arrayStoreException")
doTestException(t, "throw_classCastException", "classCastException")
doTestException(t, "throw_enumConstantNotPresentException", "test.TestThrowable$TestEnum.enumConstantNotPresentException")
doTestException(t, "throw_illegalMonitorStateException", "illegalMonitorStateException")
doTestException(t, "throw_illegalStateException", "illegalStateException")
doTestException(t, "throw_IOException", "IOException")
doTestException(t, "throw_CloneNotSupportedException", "CloneNotSupportedException")
doTestException(t, "throw_InterruptedException", "InterruptedException")
doTestException(t, "throw_InterruptedIOException", "InterruptedIOException")
doTestException(t, "throw_LambdaConversionException", "LambdaConversionException")
doTestException(t, "throw_UnmodifiableClassException", "UnmodifiableClassException")
doTestException(t, "throw_NullPointerException", "nullPointerException")
doTestException(t, "throw_UncheckedIOException", "uncheckedIOException")
doTestException(t, "throw_FileNotFoundException", "fileNotFoundException")
doTestException(t, "throw_EOFException", "EOFException")
doTestException(t, "throw_SyncFailedException", "syncFailedException")
doTestException(t, "throw_ObjectStreamException", "objectStreamException")
doTestException(t, "throw_WriteAbortedException", "writeAbortedException")
doTestException(t, "throw_InvalidObjectException", "invalidObjectException")
doTestException(t, "throw_StreamCorruptedException", "streamCorruptedException")
doTestException(t, "throw_InvalidClassException", "invalidClassException")
doTestException(t, "throw_OptionalDataException", "")
doTestException(t, "throw_NotActiveException", "notActiveException")
doTestException(t, "throw_NotSerializableException", "notSerializableException")
doTestException(t, "throw_UTFDataFormatException", "UTFDataFormatException")
doTestException(t, "throw_SecurityException", "SecurityException")
doTestException(t, "throw_IllegalArgumentException", "IllegalArgumentException")
doTestException(t, "throw_IllegalThreadStateException", "IllegalThreadStateException")
doTestException(t, "throw_NumberFormatException", "NumberFormatException")
doTestException(t, "throw_IndexOutOfBoundsException", "IndexOutOfBoundsException")
doTestException(t, "throw_ArrayIndexOutOfBoundsException", "ArrayIndexOutOfBoundsException")
doTestException(t, "throw_StringIndexOutOfBoundsException", "StringIndexOutOfBoundsException")
doTestException(t, "throw_IllegalFormatWidthException", "1000")
doTestException(t, "throw_IllegalFormatConversionException", "7 != test.TestThrowable$TestEnum")
doTestException(t, "throw_DuplicateFormatFlagsException", "flags=DuplicateFormatFlagsException")
doTestException(t, "throw_MissingResourceException", "MissingResourceException")
doTestException(t, "throw_ConcurrentModificationException", "ConcurrentModificationException")
doTestException(t, "throw_RejectedExecutionException", "RejectedExecutionException")
doTestException(t, "throw_CompletionException", "java.lang.Throwable: exception")
doTestException(t, "throw_EmptyStackException", "EmptyStackException")
doTestException(t, "throw_IllformedLocaleException", "IllformedLocaleException")
doTestException(t, "throw_NoSuchElementException", "NoSuchElementException")
doTestException(t, "throw_NegativeArraySizeException", "NegativeArraySizeException")
doTestException(t, "throw_UnsupportedOperationException", "UnsupportedOperationException")
doTestException(t, "throw_ArithmeticException", "ArithmeticException")
doTestException(t, "throw_InputMismatchException", "InputMismatchException")
doTestException(t, "throw_ExecutionException", "ExecutionException")
doTestException(t, "throw_InvalidPreferencesFormatException", "InvalidPreferencesFormatException")
doTestException(t, "throw_TimeoutException", "TimeoutException")
doTestException(t, "throw_BackingStoreException", "BackingStoreException")
doTestException(t, "throw_DataFormatException", "DataFormatException")
doTestException(t, "throw_BrokenBarrierException", "BrokenBarrierException")
doTestException(t, "throw_TooManyListenersException", "TooManyListenersException")
doTestException(t, "throw_InvalidPropertiesFormatException", "InvalidPropertiesFormatException")
doTestException(t, "throw_ZipException", "ZipException")
doTestException(t, "throw_JarException", "JarException")
doTestException(t, "throw_IllegalClassFormatException", "IllegalClassFormatException")
doTestException(t, "throw_ReflectiveOperationException", "ReflectiveOperationException")
doTestException(t, "throw_InvocationTargetException", "InvocationTargetException")
doTestException(t, "throw_NoSuchMethodException", "NoSuchMethodException")
doTestException(t, "throw_NoSuchFieldException", "NoSuchFieldException")
doTestException(t, "throw_IllegalAccessException", "IllegalAccessException")
doTestException(t, "throw_ClassNotFoundException", "ClassNotFoundException")
doTestException(t, "throw_InstantiationException", "InstantiationException")
doTestException(t, "throw_DateTimeException", "DateTimeException")
doTestException(t, "throw_UnsupportedTemporalTypeException", "UnsupportedTemporalTypeException")
doTestException(t, "throw_ZoneRulesException", "ZoneRulesException")
doTestException(t, "throw_DateTimeParseException", "DateTimeParseException")
doTestException(t, "throw_FormatterClosedException", "")
doTestException(t, "throw_CancellationException", "CancellationException")
doTestException(t, "throw_UnknownFormatConversionException", "Conversion = 'UnknownFormatConversionException'")
doTestException(t, "throw_UnknownFormatFlagsException", "Flags = UnknownFormatFlagsException")
doTestException(t, "throw_IllegalFormatFlagsException", "Flags = 'IllegalFormatFlagsException'")
doTestException(t, "throw_IllegalFormatPrecisionException", "1")
doTestException(t, "throw_IllegalFormatCodePointException", "Code point = 0x1")
doTestException(t, "throw_MissingFormatArgumentException", "Format specifier 'MissingFormatArgumentException'")
doTestException(t, "throw_MissingFormatWidthException", "MissingFormatWidthException")
doTestException(t, "throw_DubboGenericException", "DubboGenericException")
doTestException(t, "throw_IncompleteAnnotationException", "java.lang.Override missing element IncompleteAnnotationException")
doTestException(t, "throw_AnnotationTypeMismatchException", "Incorrectly typed data found for annotation element null (Found data of type AnnotationTypeMismatchException)")
}
func doTestException(t *testing.T, method, content string) {
testDecodeFrameworkFunc(t, method, func(r interface{}) {
t.Logf("%#v", r)
assert.Equal(t, content, r.(error).Error())
})
}