Search in sources :

Example 6 with NullPointerTester

use of com.google.common.testing.NullPointerTester in project guava by hceylan.

the class ImmutableSortedMapTest method testNullPointers.

@GwtIncompatible("NullPointerTester")
public void testNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(ImmutableSortedMap.class);
    tester.testAllPublicInstanceMethods(ImmutableSortedMap.<String, Integer>naturalOrder());
    tester.testAllPublicInstanceMethods(ImmutableSortedMap.of());
    tester.testAllPublicInstanceMethods(ImmutableSortedMap.of("one", 1));
    tester.testAllPublicInstanceMethods(ImmutableSortedMap.of("one", 1, "two", 2, "three", 3));
}
Also used : NullPointerTester(com.google.common.testing.NullPointerTester) GwtIncompatible(com.google.common.annotations.GwtIncompatible)

Example 7 with NullPointerTester

use of com.google.common.testing.NullPointerTester in project guava by hceylan.

the class OrderingTest method testNullPointerExceptions.

@GwtIncompatible("NullPointerTester")
public void testNullPointerExceptions() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(Ordering.class);
    // any Ordering<Object> instance that accepts nulls should be good enough
    tester.testAllPublicInstanceMethods(Ordering.usingToString().nullsFirst());
}
Also used : NullPointerTester(com.google.common.testing.NullPointerTester) GwtIncompatible(com.google.common.annotations.GwtIncompatible)

Example 8 with NullPointerTester

use of com.google.common.testing.NullPointerTester in project guava by hceylan.

the class SetsTest method testNullPointerExceptions.

@GwtIncompatible("NullPointerTester")
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);
}
Also used : AnEnum(com.google.common.collect.testing.AnEnum) SortedSet(java.util.SortedSet) Sets.newHashSet(com.google.common.collect.Sets.newHashSet) Sets.newEnumSet(com.google.common.collect.Sets.newEnumSet) EnumSet(java.util.EnumSet) Set(java.util.Set) CopyOnWriteArraySet(java.util.concurrent.CopyOnWriteArraySet) Sets.powerSet(com.google.common.collect.Sets.powerSet) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Collections.emptySet(java.util.Collections.emptySet) SafeTreeSet(com.google.common.collect.testing.SafeTreeSet) Collection(java.util.Collection) NullPointerTester(com.google.common.testing.NullPointerTester) GwtIncompatible(com.google.common.annotations.GwtIncompatible)

Example 9 with NullPointerTester

use of com.google.common.testing.NullPointerTester in project guava by hceylan.

the class MapMakerTest method testNullParameters.

public void testNullParameters() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicInstanceMethods(new MapMaker());
}
Also used : NullPointerTester(com.google.common.testing.NullPointerTester)

Example 10 with NullPointerTester

use of com.google.common.testing.NullPointerTester in project guava by hceylan.

the class MapsTest method testNullPointerExceptions.

@GwtIncompatible("NullPointerTester")
public void testNullPointerExceptions() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.setDefault(BiMap.class, ImmutableBiMap.of());
    tester.setDefault(EntryTransformer.class, ALWAYS_NULL);
    tester.setDefault(Equivalence.class, Equivalences.equals());
    tester.setDefault(SortedMap.class, Maps.newTreeMap());
    tester.testAllPublicStaticMethods(Maps.class);
}
Also used : NullPointerTester(com.google.common.testing.NullPointerTester) GwtIncompatible(com.google.common.annotations.GwtIncompatible)

Aggregations

NullPointerTester (com.google.common.testing.NullPointerTester)171 GwtIncompatible (com.google.common.annotations.GwtIncompatible)100 Test (org.junit.Test)26 UnhashableObject (com.google.common.collect.testing.UnhashableObject)2 BoundedContext (io.spine.server.BoundedContext)2 FileSystem (java.nio.file.FileSystem)2 Sets.newEnumSet (com.google.common.collect.Sets.newEnumSet)1 Sets.newHashSet (com.google.common.collect.Sets.newHashSet)1 Sets.powerSet (com.google.common.collect.Sets.powerSet)1 AnEnum (com.google.common.collect.testing.AnEnum)1 SafeTreeSet (com.google.common.collect.testing.SafeTreeSet)1 ExecutionList (com.google.common.util.concurrent.ExecutionList)1 BuildConfiguration (com.google.devtools.build.lib.analysis.config.BuildConfiguration)1 FieldDescriptor (com.google.protobuf.Descriptors.FieldDescriptor)1 StringValue (com.google.protobuf.StringValue)1 TestActorRequestFactory (io.spine.client.TestActorRequestFactory)1 Command (io.spine.core.Command)1 EventEnvelope (io.spine.core.EventEnvelope)1 AnAggregateRoot (io.spine.server.aggregate.given.AggregateRootTestEnv.AnAggregateRoot)1 TestEventFactory (io.spine.server.command.TestEventFactory)1