- Sort Score
- Num 10 results
- Language All
Results 31 - 40 of 46 for thenThrow (0.2 seconds)
-
src/test/java/jcifs/smb/SmbPipeInputStreamTest.java
when(tree.getConfig()).thenReturn(config); when(config.getTransactionBufferSize()).thenReturn(65535); when(tree.send(any(Smb2IoctlRequest.class), eq(RequestParam.NO_RETRY))).thenThrow(new SmbException("boom")); IOException ex = assertThrows(IOException.class, stream::available, "Should convert SmbException to IOException"); assertTrue(ex.getMessage().contains("boom")); }
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 9.9K bytes - Click Count (0) -
src/test/java/jcifs/pac/kerberos/KerberosTicketTest.java
try (MockedStatic<KerberosEncData> mockedEncData = Mockito.mockStatic(KerberosEncData.class)) { mockedEncData.when(() -> KerberosEncData.decrypt(ENCRYPTED_DATA, kerberosKey, ENCRYPTION_TYPE)) .thenThrow(new GeneralSecurityException("Decryption error")); PACDecodingException e = assertThrows(PACDecodingException.class, () -> new KerberosTicket(token, (byte) 0, keys));
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 11.4K bytes - Click Count (0) -
src/test/java/jcifs/smb/SmbWatchHandleImplTest.java
when(handle.getFileId()).thenReturn(new byte[16]); when(tree.send(any(CommonServerMessageBlockRequest.class), any(), any(), any())) .thenThrow(new SmbException(0xC0000120, (Throwable) null)); SmbWatchHandleImpl sut = new SmbWatchHandleImpl(handle, 0, false); List<FileNotifyInformation> result = sut.watch();
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 11.5K bytes - Click Count (0) -
src/test/java/jcifs/SmbWatchHandleTest.java
@Test void testWatchThrowsCIFSException() throws CIFSException { // Setup mock behavior CIFSException expectedException = new CIFSException("Watch operation failed"); when(watchHandle.watch()).thenThrow(expectedException); // Execute and verify CIFSException thrown = assertThrows(CIFSException.class, () -> { watchHandle.watch(); });Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 13.2K bytes - Click Count (1) -
src/test/java/jcifs/smb/SmbFileInputStreamTest.java
void readSingleByteEOF() throws Exception { // Arrange SMB2 EOF via NT status code mapping in SmbFileInputStream when(mockTree.send(any(Request.class), any(RequestParam.class))).thenThrow(new SmbException(0xC0000011, false)); // STATUS_END_OF_FILE SmbFileInputStream in = newStream(); int v = in.read(); assertEquals(-1, v); } } @Nested
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 07:14:38 GMT 2025 - 12.8K bytes - Click Count (0) -
src/test/java/jcifs/internal/fscc/FileSystemInformationTest.java
void testDecodeException() throws SMBProtocolDecodingException { byte[] buffer = new byte[100]; when(mockFileSystemInfo.decode(any(byte[].class), anyInt(), anyInt())) .thenThrow(new SMBProtocolDecodingException("Test error")); assertThrows(SMBProtocolDecodingException.class, () -> { mockFileSystemInfo.decode(buffer, 0, 100); }); } }
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 18.1K bytes - Click Count (0) -
src/test/java/jcifs/config/DelegatingConfigurationTest.java
void testExceptionHandling() { // Given RuntimeException testException = new RuntimeException("Test exception"); when(mockDelegate.getResponseTimeout()).thenThrow(testException); // When & Then RuntimeException thrownException = assertThrows(RuntimeException.class, () -> { delegatingConfig.getResponseTimeout(); });
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 20.7K bytes - Click Count (0) -
src/test/java/jcifs/internal/smb2/create/CreateContextResponseTest.java
CreateContextResponse response = mock(CreateContextResponse.class); byte[] buffer = new byte[100]; when(response.decode(any(byte[].class), anyInt(), anyInt())).thenThrow(new SMBProtocolDecodingException("Test error")); assertThrows(SMBProtocolDecodingException.class, () -> response.decode(buffer, 0, 10)); } } @Nested
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 16.2K bytes - Click Count (0) -
src/test/java/jcifs/util/HMACT64Test.java
mockedCrypto.when(Crypto::getMD5).thenReturn(mockMd5); HMACT64 originalHmac = new HMACT64(TEST_KEY); when(mockMd5.clone()).thenThrow(new CloneNotSupportedException("Test Clone Not Supported")); assertThrows(IllegalStateException.class, originalHmac::clone); } }
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 14.6K bytes - Click Count (0) -
src/test/java/jcifs/internal/AllocInfoTest.java
// Given byte[] buffer = new byte[100]; when(mockAllocInfo.decode(any(byte[].class), anyInt(), anyInt())) .thenThrow(new jcifs.internal.SMBProtocolDecodingException("Test error")); // When & Then assertThrows(jcifs.internal.SMBProtocolDecodingException.class, () -> mockAllocInfo.decode(buffer, 0, buffer.length));Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 18.8K bytes - Click Count (0)