junit.framework.TestCase.setUp()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中junit.framework.TestCase.setUp()方法的一些代码示例,展示了TestCase.setUp()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TestCase.setUp()方法的具体详情如下:
包路径:junit.framework.TestCase
类名称:TestCase
方法名:setUp

TestCase.setUp介绍

[英]Sets up the fixture, for example, open a network connection. This method is called before a test is executed.
[中]设置设备,例如,打开网络连接。在执行测试之前调用此方法。

代码示例

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 testWasRun = false;
}

代码示例来源:origin: google/guava

@Override
public void setUp() throws Exception {
 super.setUp();
 aggregateFutureLogger.addHandler(aggregateFutureLogHandler);
}

代码示例来源:origin: google/guava

@Override
public void setUp() throws Exception {
 super.setUp();
 this.cache =
   CacheBuilder.newBuilder()
     .expireAfterAccess(500000, TimeUnit.MILLISECONDS)
     .maximumSize(count)
     .build();
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 hasher = mock(Hasher.class);
 hashFunction = mock(HashFunction.class);
 when(hashFunction.newHasher()).thenReturn(hasher);
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 hasher = mock(Hasher.class);
 hashFunction = mock(HashFunction.class);
 buffer = new ByteArrayInputStream(testBytes);
 when(hashFunction.newHasher()).thenReturn(hasher);
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 fakeTicker = new FakeTicker();
}

代码示例来源:origin: google/guava

@Override
public void setUp() throws Exception {
 super.setUp();
 logHandler = new TestLogHandler();
 LocalCache.logger.addHandler(logHandler);
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 bus = new EventBus(BUS_IDENTIFIER);
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 service = SimpleTimeLimiter.create(executor);
}

代码示例来源:origin: google/guava

@Override
public void setUp() throws Exception {
 super.setUp();
 table = create();
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 DataOutputStream out = new DataOutputStream(baos);
 initializeData(out);
 data = baos.toByteArray();
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 timeLimiter = new FakeTimeLimiter();
}

代码示例来源:origin: google/guava

@Override
public void setUp() throws Exception {
 super.setUp();
 logHandler = new TestLogHandler();
 LocalCache.logger.addHandler(logHandler);
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 exec = Executors.newCachedThreadPool();
 task.addListener(
   new Runnable() {
    @Override
    public void run() {
     listenerLatch.countDown();
    }
   },
   directExecutor());
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 future = SettableFuture.create();
 tester = new ListenableFutureTester(future);
 tester.setUp();
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 inputFuture = SettableFuture.create();
 resultFuture = buildChainingFuture(inputFuture);
 listener = new MockFutureListener(resultFuture);
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 handler = new TestLogHandler();
 // You could also apply it higher up the Logger hierarchy than this
 ExampleClassUnderTest.logger.addHandler(handler);
 ExampleClassUnderTest.logger.setUseParentHandlers(false); // optional
 stack.addTearDown(
   new TearDown() {
    @Override
    public void tearDown() throws Exception {
     ExampleClassUnderTest.logger.setUseParentHandlers(true);
     ExampleClassUnderTest.logger.removeHandler(handler);
    }
   });
}

代码示例来源:origin: google/guava

@Override
protected void setUp() throws Exception {
 super.setUp();
 executor = new FakeExecutor();
 bus = new AsyncEventBus(executor);
}

代码示例来源:origin: google/guava

@Override
public void setUp() throws Exception {
 super.setUp();
 this.equivalenceMock = new MockEquivalence();
 this.tester = EquivalenceTester.of(equivalenceMock);
}

代码示例来源:origin: google/guava

@Override
public void setUp() throws Exception {
 super.setUp();
 reference = new ValidTestObject(1, 2);
 equalsTester = new EqualsTester();
 equalObject1 = new ValidTestObject(1, 2);
 equalObject2 = new ValidTestObject(1, 2);
 notEqualObject1 = new ValidTestObject(0, 2);
}

相关文章