- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 46 for thenThrow (0.09 seconds)
-
src/test/java/jcifs/SidResolverTest.java
when(sidResolver.getServerSid(eq(null), anyString())).thenThrow(new CIFSException("Context cannot be null")); assertThrows(CIFSException.class, () -> sidResolver.getServerSid(null, testServerName)); } @Test void testGetServerSid_NullServerName() throws CIFSException { when(sidResolver.getServerSid(any(CIFSContext.class), eq(null))).thenThrow(new CIFSException("Server name cannot be null"));
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 07:14:38 GMT 2025 - 15.5K bytes - Click Count (0) -
src/test/java/jcifs/smb/SmbTreeHandleInternalTest.java
} @Test @DisplayName("hasCapability(cap): propagates CIFSException on failure") void hasCapability_throws() throws Exception { // Arrange when(handle.hasCapability(anyInt())).thenThrow(new CIFSException("capability check failed")); // Act + Assert CIFSException ex = assertThrows(CIFSException.class, () -> handle.hasCapability(42));Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 9.3K bytes - Click Count (0) -
src/test/java/jcifs/NameServiceClientTest.java
// Arrange NetbiosAddress inputAddress = mock(NetbiosAddress.class); when(nameServiceClient.getNbtAllByAddress(inputAddress)).thenThrow(new UnknownHostException("Host not found")); // Act & Assert assertThrows(UnknownHostException.class, () -> nameServiceClient.getNbtAllByAddress(inputAddress));Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 15.4K bytes - Click Count (0) -
src/test/java/jcifs/smb/SmbEnumerationUtilTest.java
when(locator.getURL()).thenReturn(anyUrlWithEmptyHost); // Simulate failure to find master browser (UnknownHost wrapped in CIFSException) when(locator.getAddress()).thenThrow(new CIFSException("no master", new UnknownHostException("MB"))); // Act + Assert: the code maps this case to SmbUnsupportedOperationException
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 17.1K bytes - Click Count (0) -
src/test/java/jcifs/SmbTransportPoolTest.java
// Given when(transportPool.getSmbTransport(context, "unknown.host", DEFAULT_PORT, false, false)) .thenThrow(new UnknownHostException("Unknown host")); // When & Then assertThrows(UnknownHostException.class,Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 22.6K bytes - Click Count (0) -
src/test/java/jcifs/smb/SmbCopyUtilTest.java
SmbFileHandleImpl handle = mock(SmbFileHandleImpl.class); SmbAuthException authEx = new SmbAuthException("denied"); when(dest.openUnshared(anyInt(), anyInt(), anyInt(), anyInt(), anyInt())).thenThrow(authEx) // first attempt fails with auth .thenReturn(handle); // second attempt succeeds // dest currently has READONLY attribute set
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 12.1K bytes - Click Count (0) -
src/test/java/jcifs/SmbTreeTest.java
/** * Test for unwrap() method throwing exception. * Verifies that unwrap can throw exceptions when appropriate. */ @Test void testUnwrap_throwsException() { when(smbTree.unwrap(any())).thenThrow(new ClassCastException("Cannot unwrap to specified type")); assertThrows(ClassCastException.class, () -> smbTree.unwrap(CustomSmbTree.class), "Should throw ClassCastException when type is incompatible");Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 9.2K bytes - Click Count (0) -
src/test/java/jcifs/smb/SmbPipeOutputStreamTest.java
// Arrange SmbPipeOutputStream out = newStream(); CIFSException boom = new CIFSException("tree-fail"); when(handle.ensureTreeConnected()).thenThrow(boom); // Act + Assert CIFSException ex = assertThrows(CIFSException.class, out::ensureTreeConnected); assertEquals("tree-fail", ex.getMessage());Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 5.4K bytes - Click Count (0) -
src/test/java/jcifs/smb/SmbTreeInternalTest.java
} @Test @DisplayName("send throws CIFSException for null request when implementation does") void send_nullRequest_throws() throws Exception { // Arrange when(tree.send(isNull())).thenThrow(new CIFSException("null request")); // Act CIFSException ex = assertThrows(CIFSException.class, () -> tree.send(null)); // Assert assertEquals("null request", ex.getMessage());Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 5.6K bytes - Click Count (0) -
src/test/java/jcifs/SmbTreeHandleTest.java
* @throws CIFSException */ @Test void testGetServerTimeZoneOffset_throwsCIFSException() throws CIFSException { when(smbTreeHandle.getServerTimeZoneOffset()).thenThrow(new CIFSException("Test Exception")); assertThrows(CIFSException.class, () -> smbTreeHandle.getServerTimeZoneOffset(), "getServerTimeZoneOffset() should throw CIFSException"); } /**Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 7.1K bytes - Click Count (0)