@@ -152,49 +152,6 @@ void logout_shouldCallCLogout() {
152152 verify (pkcs11Mock , times (1 )).C_Logout (any (NativeLong .class ));
153153 }
154154
155- @ Test
156- void logout_failure_shouldThrowSessionLogoutException () {
157- when (pkcs11Mock .C_OpenSession (any (NativeLong .class ), any (NativeLong .class ), isNull (), isNull (), any (NativeLongByReference .class )))
158- .thenAnswer (invocation -> {
159- NativeLongByReference sessionRef = invocation .getArgument (4 );
160- sessionRef .setValue (new NativeLong (1 ));
161- return new NativeLong (Pkcs11Constants .CKR_OK );
162- });
163-
164- when (pkcs11Mock .C_Login (any (NativeLong .class ), any (NativeLong .class ), any (), any (NativeLong .class )))
165- .thenReturn (new NativeLong (Pkcs11Constants .CKR_OK ));
166-
167- pkcs11Session = new PKCS11Session (pkcs11Mock , pin , slotId );
168-
169- when (pkcs11Mock .C_Logout (any (NativeLong .class ))).thenThrow (new RuntimeException ("Logout failed" ));
170-
171- assertThrows (SessionLogoutException .class , () -> pkcs11Session .logout ());
172- }
173-
174- @ Test
175- void close_shouldCallCLogoutAndCCloseSessionAndCFinalize () {
176- when (pkcs11Mock .C_OpenSession (any (NativeLong .class ), any (NativeLong .class ), isNull (), isNull (), any (NativeLongByReference .class )))
177- .thenAnswer (invocation -> {
178- NativeLongByReference sessionRef = invocation .getArgument (4 );
179- sessionRef .setValue (new NativeLong (1 ));
180- return new NativeLong (Pkcs11Constants .CKR_OK );
181- });
182-
183- when (pkcs11Mock .C_Login (any (NativeLong .class ), any (NativeLong .class ), any (), any (NativeLong .class )))
184- .thenReturn (new NativeLong (Pkcs11Constants .CKR_OK ));
185-
186- pkcs11Session = new PKCS11Session (pkcs11Mock , pin , slotId );
187-
188- when (pkcs11Mock .C_Logout (any (NativeLong .class ))).thenReturn (new NativeLong (Pkcs11Constants .CKR_OK ));
189- when (pkcs11Mock .C_CloseSession (any (NativeLong .class ))).thenReturn (new NativeLong (Pkcs11Constants .CKR_OK ));
190- when (pkcs11Mock .C_Finalize (isNull ())).thenReturn (new NativeLong (Pkcs11Constants .CKR_OK ));
191-
192- pkcs11Session .close ();
193-
194- verify (pkcs11Mock , times (1 )).C_Logout (any (NativeLong .class ));
195- verify (pkcs11Mock , times (1 )).C_CloseSession (any (NativeLong .class ));
196- verify (pkcs11Mock , times (1 )).C_Finalize (isNull ());
197- }
198155
199156 @ Test
200157 void close_failure_shouldThrowSessionCloseException () {
0 commit comments