Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 43 for thenThrow (0.04 sec)

  1. 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"));
    
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 07:14:38 UTC 2025
    - 15.5K bytes
    - Viewed (0)
  2. 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));
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 9.3K bytes
    - Viewed (0)
  3. 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));
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 15.4K bytes
    - Viewed (0)
  4. 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
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 17.1K bytes
    - Viewed (0)
  5. 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,
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 22.6K bytes
    - Viewed (0)
  6. 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
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 12.1K bytes
    - Viewed (0)
  7. 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");
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 9.2K bytes
    - Viewed (0)
  8. 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();
    
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sun Aug 31 08:00:57 UTC 2025
    - 19.2K bytes
    - Viewed (0)
  9. 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");
        }
    
        /**
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 7.1K bytes
    - Viewed (0)
  10. 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());
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 5.4K bytes
    - Viewed (0)
Back to top