Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 44 for thenThrow (0.08 sec)

  1. 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());
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 5.6K bytes
    - Viewed (0)
  2. src/test/java/jcifs/smb/SmbResourceLocatorInternalTest.java

        @Test
        @DisplayName("overlaps throws CIFSException when implementation fails")
        void overlapsThrowsCifsException() throws Exception {
            when(locator.overlaps(any())).thenThrow(new CIFSException("Simulated failure"));
    
            CIFSException ex = assertThrows(CIFSException.class, () -> locator.overlaps(other));
            assertTrue(ex.getMessage().contains("Simulated failure"));
    
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 6.9K bytes
    - Viewed (0)
  3. 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);
    
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 07:14:38 UTC 2025
    - 13K bytes
    - Viewed (0)
  4. 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"));
        }
    
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 07:14:38 UTC 2025
    - 14.2K bytes
    - Viewed (0)
  5. src/test/java/jcifs/AddressTest.java

        @Test
        @DisplayName("toInetAddress should handle UnknownHostException")
        void testToInetAddressWithException() throws UnknownHostException {
            // Given
            when(mockAddress.toInetAddress()).thenThrow(new UnknownHostException("Host not found"));
    
            // When & Then
            assertThrows(UnknownHostException.class, () -> {
                mockAddress.toInetAddress();
            }, "Should propagate UnknownHostException");
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 4.9K bytes
    - Viewed (0)
  6. 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());
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 07:14:38 UTC 2025
    - 10.6K bytes
    - Viewed (0)
  7. src/test/java/jcifs/smb/SmbUnsupportedOperationExceptionTest.java

            // we need to use a method that can throw checked exceptions or wrap it in a RuntimeException
            @SuppressWarnings("unchecked")
            Supplier<String> supplier = mock(Supplier.class);
            when(supplier.get()).thenThrow(new RuntimeException(new SmbUnsupportedOperationException("boom")));
    
            // Act & Assert: the exception is propagated and interaction recorded once
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 5.2K bytes
    - Viewed (0)
  8. src/test/java/jcifs/smb/DosFileFilterTest.java

            // and a mock file that throws an exception when getAttributes is called
            SmbException expectedException = new SmbException("Failed to get attributes");
            when(mockFile.getAttributes()).thenThrow(expectedException);
    
            // When calling accept
            // Then an SmbException should be thrown
            SmbException thrown = assertThrows(SmbException.class, () -> {
                dosFileFilter.accept(mockFile);
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 6.2K bytes
    - Viewed (0)
  9. 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
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 14.4K bytes
    - Viewed (0)
  10. src/test/java/jcifs/smb/DfsImplTest.java

            // Mock transport to throw IOException - simulating connection failure
            when(mockTransportPool.getSmbTransport(any(CIFSContext.class), anyString(), anyInt(), anyBoolean(), anyBoolean()))
                    .thenThrow(new IOException("Connection failed"));
    
            // Instantiate the class under test
            dfsImpl = new DfsImpl(mockContext);
        }
    
        // Test for the constructor
        @Test
        void testDfsImplConstructor() {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 5.5K bytes
    - Viewed (0)
Back to top