1
1
/*
2
- * Copyright 2009-2023 the original author or authors.
2
+ * Copyright 2009-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
21
21
import static org .mockito .Mockito .when ;
22
22
23
23
import java .io .Reader ;
24
- import java .sql .Clob ;
24
+ import java .sql .NClob ;
25
25
26
26
import org .junit .jupiter .api .Test ;
27
27
import org .mockito .ArgumentMatchers ;
@@ -32,60 +32,60 @@ class NClobTypeHandlerTest extends BaseTypeHandlerTest {
32
32
private static final TypeHandler <String > TYPE_HANDLER = new NClobTypeHandler ();
33
33
34
34
@ Mock
35
- protected Clob clob ;
35
+ protected NClob nclob ;
36
36
37
37
@ Override
38
38
@ Test
39
39
public void shouldSetParameter () throws Exception {
40
40
TYPE_HANDLER .setParameter (ps , 1 , "Hello" , null );
41
- verify (ps ).setCharacterStream (ArgumentMatchers .eq (1 ), ArgumentMatchers .any (Reader .class ), ArgumentMatchers .eq (5 ));
41
+ verify (ps ).setNCharacterStream (ArgumentMatchers .eq (1 ), ArgumentMatchers .any (Reader .class ), ArgumentMatchers .eq (5L ));
42
42
}
43
43
44
44
@ Override
45
45
@ Test
46
46
public void shouldGetResultFromResultSetByName () throws Exception {
47
- when (rs .getClob ("column" )).thenReturn (clob );
48
- when (clob .length ()).thenReturn (3L );
49
- when (clob .getSubString (1 , 3 )).thenReturn ("Hello" );
47
+ when (rs .getNClob ("column" )).thenReturn (nclob );
48
+ when (nclob .length ()).thenReturn (3L );
49
+ when (nclob .getSubString (1 , 3 )).thenReturn ("Hello" );
50
50
assertEquals ("Hello" , TYPE_HANDLER .getResult (rs , "column" ));
51
51
}
52
52
53
53
@ Override
54
54
@ Test
55
55
public void shouldGetResultNullFromResultSetByName () throws Exception {
56
- when (rs .getClob ("column" )).thenReturn (null );
56
+ when (rs .getNClob ("column" )).thenReturn (null );
57
57
assertNull (TYPE_HANDLER .getResult (rs , "column" ));
58
58
}
59
59
60
60
@ Override
61
61
@ Test
62
62
public void shouldGetResultFromResultSetByPosition () throws Exception {
63
- when (rs .getClob (1 )).thenReturn (clob );
64
- when (clob .length ()).thenReturn (3L );
65
- when (clob .getSubString (1 , 3 )).thenReturn ("Hello" );
63
+ when (rs .getNClob (1 )).thenReturn (nclob );
64
+ when (nclob .length ()).thenReturn (3L );
65
+ when (nclob .getSubString (1 , 3 )).thenReturn ("Hello" );
66
66
assertEquals ("Hello" , TYPE_HANDLER .getResult (rs , 1 ));
67
67
}
68
68
69
69
@ Override
70
70
@ Test
71
71
public void shouldGetResultNullFromResultSetByPosition () throws Exception {
72
- when (rs .getClob (1 )).thenReturn (null );
72
+ when (rs .getNClob (1 )).thenReturn (null );
73
73
assertNull (TYPE_HANDLER .getResult (rs , 1 ));
74
74
}
75
75
76
76
@ Override
77
77
@ Test
78
78
public void shouldGetResultFromCallableStatement () throws Exception {
79
- when (cs .getClob (1 )).thenReturn (clob );
80
- when (clob .length ()).thenReturn (3L );
81
- when (clob .getSubString (1 , 3 )).thenReturn ("Hello" );
79
+ when (cs .getNClob (1 )).thenReturn (nclob );
80
+ when (nclob .length ()).thenReturn (3L );
81
+ when (nclob .getSubString (1 , 3 )).thenReturn ("Hello" );
82
82
assertEquals ("Hello" , TYPE_HANDLER .getResult (cs , 1 ));
83
83
}
84
84
85
85
@ Override
86
86
@ Test
87
87
public void shouldGetResultNullFromCallableStatement () throws Exception {
88
- when (cs .getClob (1 )).thenReturn (null );
88
+ when (cs .getNClob (1 )).thenReturn (null );
89
89
assertNull (TYPE_HANDLER .getResult (cs , 1 ));
90
90
}
91
91
0 commit comments