Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 105 for ClassCastException (0.96 sec)

  1. android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionContainsTester.java

      }
    
      public void testContains_wrongType() {
        try {
          assertFalse(
              "contains(wrongType) should return false or throw", collection.contains(WrongType.VALUE));
        } catch (ClassCastException tolerated) {
        }
      }
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Nov 14 23:40:07 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java

         * allowed, and will cause {@link #build} to fail.
         *
         * @throws NullPointerException if any key or value in {@code map} is null
         * @throws ClassCastException if any value is not an instance of the type specified by its key
         */
        @CanIgnoreReturnValue
        public <T extends B> Builder<B> putAll(Map<? extends Class<? extends T>, ? extends T> map) {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Mar 17 20:26:29 UTC 2025
    - 7.1K bytes
    - Viewed (0)
  3. guava/src/com/google/common/collect/EnumMultiset.java

       * Returns {@code element} cast to {@code E}, if it actually is a nonnull E. Otherwise, throws
       * either a NullPointerException or a ClassCastException as appropriate.
       */
      private void checkIsE(Object element) {
        checkNotNull(element);
        if (!isActuallyE(element)) {
          throw new ClassCastException("Expected an " + type + " but got " + element);
        }
      }
    
      @Override
      int distinctElements() {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 9.3K bytes
    - Viewed (0)
  4. src/test/java/jcifs/smb/SmbPipeHandleImplTest.java

            // Happy path: unwrap to concrete type
            SmbPipeHandleImpl unwrapped = target.unwrap(SmbPipeHandleImpl.class);
            assertSame(target, unwrapped);
    
            // Incompatible type: expect ClassCastException
            class OtherPipeHandle implements SmbPipeHandle {
                @Override
                public SmbPipeResource getPipe() {
                    return mock(SmbPipeResource.class);
                }
    
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 11.7K bytes
    - Viewed (0)
  5. android/guava/src/com/google/common/collect/TreeMultiset.java

       * {@code ClassCastException} for any elements {@code e1} and {@code e2} in the multiset. If the
       * user attempts to add an element to the multiset that violates this constraint (for example, the
       * user attempts to add a string element to a set whose elements are integers), the {@code
       * add(Object)} call will throw a {@code ClassCastException}.
       *
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 33.8K bytes
    - Viewed (0)
  6. src/test/java/jcifs/smb/SmbSessionImplTest.java

            assertSame(session, session.unwrap(jcifs.SmbSession.class));
    
            // Edge: force incompatible class via raw type to trigger ClassCastException
            assertThrows(ClassCastException.class, () -> session.unwrap((Class) String.class));
        }
    
        @Test
        @DisplayName("toString contains key identifiers")
        void testToString() {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 12.5K bytes
    - Viewed (0)
  7. android/guava-testlib/src/com/google/common/collect/testing/testers/MapGetTester.java

      }
    
      public void testGet_wrongType() {
        try {
          assertNull("get(wrongType) should return null or throw", getMap().get(WrongType.VALUE));
        } catch (ClassCastException tolerated) {
        }
      }
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Nov 14 23:40:07 UTC 2024
    - 3.1K bytes
    - Viewed (0)
  8. guava-testlib/src/com/google/common/collect/testing/testers/AbstractListIndexOfTester.java

            find(null));
      }
    
      public void testFind_wrongType() {
        try {
          assertEquals(
              getMethodName() + "(wrongType) should return -1 or throw", -1, find(WrongType.VALUE));
        } catch (ClassCastException tolerated) {
        }
      }
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Sun Dec 22 03:38:46 UTC 2024
    - 3.4K bytes
    - Viewed (0)
  9. guava-tests/test/com/google/common/base/ThrowablesTest.java

        assertThat(getCauseAs(thrown, SomeCheckedException.class)).isSameInstanceAs(cause);
        assertThat(getCauseAs(thrown, Exception.class)).isSameInstanceAs(cause);
    
        ClassCastException expected =
            assertThrows(
                ClassCastException.class, () -> getCauseAs(thrown, IllegalStateException.class));
        assertThat(expected).hasCauseThat().isSameInstanceAs(thrown);
      }
    
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 14.9K bytes
    - Viewed (0)
  10. android/guava-tests/test/com/google/common/base/ThrowablesTest.java

        assertThat(getCauseAs(thrown, SomeCheckedException.class)).isSameInstanceAs(cause);
        assertThat(getCauseAs(thrown, Exception.class)).isSameInstanceAs(cause);
    
        ClassCastException expected =
            assertThrows(
                ClassCastException.class, () -> getCauseAs(thrown, IllegalStateException.class));
        assertThat(expected).hasCauseThat().isSameInstanceAs(thrown);
      }
    
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 14.9K bytes
    - Viewed (0)
Back to top