本文整理汇总了Java中com.google.common.testing.NullPointerTester.testInstanceMethods方法的典型用法代码示例。如果您正苦于以下问题:Java NullPointerTester.testInstanceMethods方法的具体用法?Java NullPointerTester.testInstanceMethods怎么用?Java NullPointerTester.testInstanceMethods使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.testing.NullPointerTester
的用法示例。
在下文中一共展示了NullPointerTester.testInstanceMethods方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNullPointers
import com.google.common.testing.NullPointerTester; //导入方法依赖的package包/类
@GwtIncompatible // NullPointerTester
public void testNullPointers() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(Joiner.class);
tester.testInstanceMethods(Joiner.on(","), NullPointerTester.Visibility.PACKAGE);
tester.testInstanceMethods(Joiner.on(",").skipNulls(), NullPointerTester.Visibility.PACKAGE);
tester.testInstanceMethods(
Joiner.on(",").useForNull("x"), NullPointerTester.Visibility.PACKAGE);
tester.testInstanceMethods(
Joiner.on(",").withKeyValueSeparator("="), NullPointerTester.Visibility.PACKAGE);
}
示例2: testNulls
import com.google.common.testing.NullPointerTester; //导入方法依赖的package包/类
public void testNulls() {
NullPointerTester tester = new NullPointerTester()
.setDefault(SleepingStopwatch.class, stopwatch)
.setDefault(int.class, 1)
.setDefault(double.class, 1.0d);
tester.testStaticMethods(RateLimiter.class, Visibility.PACKAGE);
tester.testInstanceMethods(RateLimiter.create(stopwatch, 5.0), Visibility.PACKAGE);
}
示例3: testNullContracts
import com.google.common.testing.NullPointerTester; //导入方法依赖的package包/类
@Test
public void testNullContracts() throws Exception {
NullPointerTester nullPointerTester = new NullPointerTester();
Class<?> clazz = uut.getClass();
nullPointerTester.testAllPublicConstructors(clazz);
nullPointerTester.testAllPublicStaticMethods(clazz);
nullPointerTester.testInstanceMethods(uut, NullPointerTester.Visibility.PROTECTED);
nullPointerTester.testStaticMethods(clazz, NullPointerTester.Visibility.PROTECTED);
}
示例4: testNullContracts
import com.google.common.testing.NullPointerTester; //导入方法依赖的package包/类
@Test
public void testNullContracts() throws Exception {
// given
NullPointerTester nullPointerTester = new NullPointerTester();
nullPointerTester.setDefault(QueueName.class, new QueueName("name"));
nullPointerTester.setDefault(VisibilityTimeoutExtenderFactory.class,
timeoutExtenderFactory);
nullPointerTester.setDefault(QueueFactory.class, queueFactory);
// when
nullPointerTester.testInstanceMethods(uut, NullPointerTester.Visibility.PACKAGE);
nullPointerTester.testAllPublicConstructors(uut.getClass());
}
示例5: testNullContracts
import com.google.common.testing.NullPointerTester; //导入方法依赖的package包/类
@Test
public void testNullContracts() throws Exception {
// given
NullPointerTester nullPointerTester = new NullPointerTester();
nullPointerTester.setDefault(SetWithUpperBound.class, new SetWithUpperBound<Integer>(5));
nullPointerTester.setDefault(VisibilityTimeoutExtender.class, Mockito.mock(
VisibilityTimeoutExtender.class));
// when
nullPointerTester.testInstanceMethods(uut, NullPointerTester.Visibility.PACKAGE);
nullPointerTester.testAllPublicConstructors(uut.getClass());
}
示例6: testNullContracts
import com.google.common.testing.NullPointerTester; //导入方法依赖的package包/类
@Test
public void testNullContracts() throws Exception {
// given
NullPointerTester nullPointerTester = new NullPointerTester();
// when
nullPointerTester.testInstanceMethods(uut, NullPointerTester.Visibility.PACKAGE);
nullPointerTester.testAllPublicConstructors(uut.getClass());
}
示例7: testNullContracts
import com.google.common.testing.NullPointerTester; //导入方法依赖的package包/类
@Test
public void testNullContracts() throws Exception {
// given
SetWithUpperBound<Integer> uut = new SetWithUpperBound<>(4);
NullPointerTester nullPointerTester = new NullPointerTester();
// when
nullPointerTester.testInstanceMethods(uut, NullPointerTester.Visibility.PACKAGE);
nullPointerTester.testAllPublicConstructors(uut.getClass());
}
示例8: testNullContracts
import com.google.common.testing.NullPointerTester; //导入方法依赖的package包/类
@Test
public void testNullContracts() throws Exception {
// given
NullPointerTester nullPointerTester = new NullPointerTester();
nullPointerTester.setDefault(VisibilityTimeoutExtenderFactory.class,
timeoutExtenderFactory);
nullPointerTester.setDefault(Queue.class, queue);
// when
nullPointerTester.testInstanceMethods(uut, NullPointerTester.Visibility.PACKAGE);
nullPointerTester.testConstructors(uut.getClass(), Visibility.PACKAGE);
}
示例9: testNullContracts
import com.google.common.testing.NullPointerTester; //导入方法依赖的package包/类
@Test
public void testNullContracts() throws Exception {
// given
NullPointerTester nullPointerTester = new NullPointerTester();
nullPointerTester.setDefault(Queue.class, Mockito.mock(Queue.class));
// when
nullPointerTester.testInstanceMethods(uut, NullPointerTester.Visibility.PACKAGE);
nullPointerTester.testAllPublicConstructors(uut.getClass());
}
示例10: testNullContracts
import com.google.common.testing.NullPointerTester; //导入方法依赖的package包/类
@Test
public void testNullContracts() throws Exception {
// given
NullPointerTester nullPointerTester = new NullPointerTester();
nullPointerTester.ignore(uut.getClass().getDeclaredMethod("canEqual", Object.class));
nullPointerTester.ignore(uut.getClass().getDeclaredMethod("equals", Object.class));
nullPointerTester.setDefault(QueueName.class, new QueueName("asiudb"));
// when
nullPointerTester.testInstanceMethods(uut, NullPointerTester.Visibility.PACKAGE);
nullPointerTester.testAllPublicConstructors(uut.getClass());
}