Package com.google.common.testutils

Examples of com.google.common.testutils.NullPointerTester.testAllPublicStaticMethods()


    // 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);
  }

  public void testNewSetFromMap() {
    Set<Integer> set = Sets.newSetFromMap(new HashMap<Integer, Boolean>());
    set.addAll(SOME_COLLECTION);
View Full Code Here


    } catch (IllegalArgumentException expected) {}
  }

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

  public void testSerialization_empty() {
    Collection<String> c = ImmutableMultiset.of();
    assertSame(c, SerializableTester.reserialize(c));
View Full Code Here

    }   
  }

  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
View Full Code Here

    }
  }

  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
View Full Code Here

  }

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

  private static final Map<Integer,Integer> EMPTY
      = Collections.emptyMap();
  private static final Map<Integer,Integer> SINGLETON
View Full Code Here

    assertEquals(Collections.singleton(array), set);
  }

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

  public void testChooseTableSize() {
    assertEquals(8, Hashing.chooseTableSize(3));
    assertEquals(16, Hashing.chooseTableSize(4));
View Full Code Here

*/
public class ObjectArraysTest extends TestCase {

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

  public void testNewArray_fromClass_Empty() {
    String[] empty = ObjectArrays.newArray(String.class, 0);
    assertEquals(String[].class, empty.getClass());
View Full Code Here

    return ImmutableSortedSet.copyOf(elements);
  }

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

  public void testEmpty_comparator() {
    SortedSet<String> set = ImmutableSortedSet.of();
    assertSame(Ordering.natural(), set.comparator());
View Full Code Here

      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));
    }

    public void testSerialization_empty() {
View Full Code Here

    assertFalse(changed);
  }

  public void testNullPointerExceptions() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(Iterators.class);
  }

  private static abstract class EmptyIteratorTester
      extends IteratorTester<Integer> {
    protected EmptyIteratorTester() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.