Search in sources :

Example 76 with NullPointerTester

use of com.google.common.testing.NullPointerTester in project google-cloud-java by GoogleCloudPlatform.

the class CloudStorageFileSystemProviderTest method testNullness.

@Test
public void testNullness() throws Exception {
    try (FileSystem fs = FileSystems.getFileSystem(URI.create("gs://blood"))) {
        NullPointerTester tester = new NullPointerTester();
        tester.ignore(CloudStorageFileSystemProvider.class.getMethod("equals", Object.class));
        tester.setDefault(URI.class, URI.create("gs://blood"));
        tester.setDefault(Path.class, fs.getPath("and/one"));
        tester.setDefault(OpenOption.class, CREATE);
        tester.setDefault(CopyOption.class, COPY_ATTRIBUTES);
        // can't do that, setStorageOptions accepts a null argument.
        // TODO(jart): Figure out how to re-enable this.
        // tester.testAllPublicStaticMethods(CloudStorageFileSystemProvider.class);
        tester.testAllPublicInstanceMethods(new CloudStorageFileSystemProvider());
    }
}
Also used : FileSystem(java.nio.file.FileSystem) NullPointerTester(com.google.common.testing.NullPointerTester) Test(org.junit.Test)

Example 77 with NullPointerTester

use of com.google.common.testing.NullPointerTester in project google-cloud-java by GoogleCloudPlatform.

the class CloudStorageOptionsTest method testNullness.

@Test
public void testNullness() {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(CloudStorageOptions.class);
}
Also used : NullPointerTester(com.google.common.testing.NullPointerTester) Test(org.junit.Test)

Example 78 with NullPointerTester

use of com.google.common.testing.NullPointerTester in project core-java by SpineEventEngine.

the class FieldShould method pass_the_null_tolerance_check.

@Test
public void pass_the_null_tolerance_check() {
    final FieldDescriptor defaultFieldDescriptor = StringValue.getDefaultInstance().getDescriptorForType().getFields().get(0);
    new NullPointerTester().setDefault(TypeUrl.class, TypeUrl.of(StringValue.class)).setDefault(FieldDescriptor.class, defaultFieldDescriptor).testAllPublicStaticMethods(Messages.class);
}
Also used : NullPointerTester(com.google.common.testing.NullPointerTester) StringValue(com.google.protobuf.StringValue) MessageWithStringValue(io.spine.test.reflect.MessageWithStringValue) FieldDescriptor(com.google.protobuf.Descriptors.FieldDescriptor) Test(org.junit.Test)

Example 79 with NullPointerTester

use of com.google.common.testing.NullPointerTester in project core-java by SpineEventEngine.

the class EntityColumnCacheShould method pass_null_check.

@Test
public void pass_null_check() {
    new NullPointerTester().testAllPublicStaticMethods(EntityColumnCache.class);
    new NullPointerTester().testAllPublicInstanceMethods(entityColumnCache);
}
Also used : NullPointerTester(com.google.common.testing.NullPointerTester) Test(org.junit.Test)

Example 80 with NullPointerTester

use of com.google.common.testing.NullPointerTester in project core-java by SpineEventEngine.

the class EventRoutingShould method pass_null_tolerance.

@Test
public void pass_null_tolerance() {
    final NullPointerTester nullPointerTester = new NullPointerTester().setDefault(EventContext.class, EventContext.getDefaultInstance());
    nullPointerTester.testAllPublicInstanceMethods(eventRouting);
    nullPointerTester.testAllPublicStaticMethods(EventRouting.class);
}
Also used : NullPointerTester(com.google.common.testing.NullPointerTester) Test(org.junit.Test)

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