Package com.google.common.testutils

Examples of com.google.common.testutils.NullPointerTester


      fail();
    } catch (IllegalArgumentException expected) {}
  }

  public void testNullPointerExceptions() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.setDefault(Enum.class, SomeEnum.A);

    // TODO: make NPT create empty arrays for defaults automatically
    tester.setDefault(Collection[].class, new Collection[0]);
    tester.setDefault(Enum[].class, new Enum[0]);
    tester.setDefault(Set[].class, new Set[0]);
    tester.testAllPublicStaticMethods(Sets.class);
  }
View Full Code Here


      fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException expected) {}
  }

  public void testNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(ImmutableMultiset.class);
  }
View Full Code Here

      assertSame(comparator, map.comparator());
    }   
  }

  public void testNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(ImmutableSortedMap.class);
    tester.testAllPublicInstanceMethods(
        ImmutableSortedMap.<String, Integer>naturalOrder());
    if (false) {
      // these tests aren't included due to a bug in NullPointerTester
      // TODO: fix that bug, add these tests
      tester.testAllPublicInstanceMethods(ImmutableSortedMap.of());
      tester.testAllPublicInstanceMethods(ImmutableSortedMap.of("one", 1));
      tester.testAllPublicInstanceMethods(
          ImmutableSortedMap.of("one", 1, "two", 2, "three", 3));
    }
  }
View Full Code Here

      assertSame(copy, ImmutableMap.copyOf(copy));
    }
  }

  public void testNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(ImmutableMap.class);
    tester.testAllPublicInstanceMethods(
        new ImmutableMap.Builder<Object, Object>());
    if (false) {
      // these tests aren't included due to a bug in NullPointerTester
      // TODO: fix that bug, add these tests
      tester.testAllPublicInstanceMethods(ImmutableMap.of());
      tester.testAllPublicInstanceMethods(ImmutableMap.of("one", 1));
      tester.testAllPublicInstanceMethods(
          ImmutableMap.of("one", 1, "two", 2, "three", 3));
    }
  }
View Full Code Here

      fail("Empty map must result in an IllegalArgumentException");
    } catch (IllegalArgumentException expected) {}
  }

  public void testNullPointerExceptions() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.setDefault(BiMap.class, ImmutableBiMap.of());
    tester.testAllPublicStaticMethods(Maps.class);
  }
View Full Code Here

    Set<String[]> set = ImmutableSet.<String[]>of(array);
    assertEquals(Collections.singleton(array), set);
  }

  public void testNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(ImmutableSet.class);
  }
View Full Code Here

* @author Kevin Bourrillion
*/
public class ObjectArraysTest extends TestCase {

  public void testNullPointerExceptions() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(ObjectArrays.class);
  }
View Full Code Here

  @Override protected Set<String> copyOf(Iterator<String> elements) {
    return ImmutableSortedSet.copyOf(elements);
  }

  public void testNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(ImmutableSortedSet.class);
  }
View Full Code Here

              new Class[] {ConcurrentlyMutatedList.class}, invocationHandler);
      return list;
    }

    public void testNullPointers() throws Exception {
      NullPointerTester tester = new NullPointerTester();
      tester.testAllPublicStaticMethods(ImmutableList.class);
      // TODO: get this re-enabled
      // tester.testAllPublicInstanceMethods(ImmutableList.of(1, 2, 3));
    }
View Full Code Here

    assertEquals("a", array[0]);
    assertNull(array[1]);
  }

  public void testNullPointerExceptions() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicInstanceMethods(c);
  }
View Full Code Here

TOP

Related Classes of com.google.common.testutils.NullPointerTester

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.