- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 33 for thenThrow (0.06 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/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/smb/SmbTransportPoolImplTest.java
when(trans1.unwrap(SmbTransportImpl.class)).thenReturn(trans1); when(trans1.ensureConnected()).thenThrow(firstException); doNothing().when(trans1).close(); when(trans2.unwrap(SmbTransportImpl.class)).thenReturn(trans2); when(trans2.ensureConnected()).thenThrow(secondException); doNothing().when(trans2).close();Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Sun Aug 31 08:00:57 GMT 2025 - 19.2K bytes - Click Count (0) -
src/test/java/jcifs/smb/SmbTreeConnectionTest.java
// Configure the tree to throw transport error on first call, succeed on second when(tree.send(eq(req), eq(resp), anySet())) .thenThrow(new SmbException("transport error", new jcifs.util.transport.TransportException())) .thenReturn(resp); setTree(c, tree);Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 07:14:38 GMT 2025 - 13K bytes - Click Count (0) -
src/test/java/jcifs/smb/Kerb5ContextTest.java
void calculateMIC_failure_wraps() throws Exception { byte[] data = new byte[] { 0 }; when(gssContext.getMIC(any(), anyInt(), anyInt(), any())).thenThrow(new GSSException(GSSException.FAILURE)); CIFSException ex = assertThrows(CIFSException.class, () -> ctx.calculateMIC(data)); assertTrue(ex.getMessage().contains("Failed to calculate MIC")); }
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 07:14:38 GMT 2025 - 14.2K bytes - Click Count (0) -
src/test/java/jcifs/smb/FileEntryAdapterIteratorTest.java
FileEntry entry2 = mock(FileEntry.class); when(delegate.hasNext()).thenReturn(true, true, false); when(delegate.next()).thenReturn(entry1, entry2); when(filter.accept(resource)).thenThrow(new CIFSException("Error")).thenReturn(true); TestIterator iterator = new TestIterator(filter); // Verify iteration assertTrue(iterator.hasNext());
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 07:14:38 GMT 2025 - 10.6K bytes - Click Count (0) -
src/test/java/jcifs/smb/SmbTreeHandleImplTest.java
assertTrue(handle.hasCapability(123)); verify(treeConnection).hasCapability(123); // Exception path when(treeConnection.hasCapability(999)).thenThrow(new SmbException("Not connected")); SmbException ex = assertThrows(SmbException.class, () -> handle.hasCapability(999)); assertTrue(ex.getMessage().contains("Not connected")); } @Test
Created: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 14.4K bytes - Click Count (0)