File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
src/test/java/org/apache/ibatis/type Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change 15
15
*/
16
16
package org .apache .ibatis .type ;
17
17
18
- import static org .junit .jupiter .api .Assertions .assertEquals ;
19
- import static org .junit .jupiter .api .Assertions .assertNull ;
20
- import static org .junit .jupiter .api .Assertions .assertThrows ;
21
-
22
18
import java .math .BigDecimal ;
23
19
24
20
import org .junit .jupiter .api .Test ;
25
21
22
+ import static org .assertj .core .api .Assertions .*;
23
+ import static org .junit .jupiter .api .Assertions .*;
24
+
26
25
class TypeAliasRegistryTest {
27
26
28
27
@ Test
@@ -75,4 +74,21 @@ void shouldFetchCharType() {
75
74
assertEquals (char [].class , typeAliasRegistry .resolveAlias ("_char[]" ));
76
75
}
77
76
77
+ @ Test
78
+ void shouldNotBeAbleToRegisterAliasWithEmptyString () {
79
+ TypeAliasRegistry typeAliasRegistry = new TypeAliasRegistry ();
80
+
81
+ assertThatThrownBy (() -> typeAliasRegistry .registerAlias ("foo" , "" ))
82
+ .isInstanceOf (TypeException .class )
83
+ .hasMessageContaining ("Error registering type alias foo for" );
84
+ }
85
+
86
+ @ Test
87
+ void shouldNotBeAbleToResolveNotExistsAlias () {
88
+ TypeAliasRegistry typeAliasRegistry = new TypeAliasRegistry ();
89
+
90
+ assertThatThrownBy (() -> typeAliasRegistry .resolveAlias ("abc" ))
91
+ .isInstanceOf (TypeException .class )
92
+ .hasMessageContaining ("Could not resolve type alias 'abc'. Cause: java.lang.ClassNotFoundException: Cannot find class: abc" );
93
+ }
78
94
}
You can’t perform that action at this time.
0 commit comments