类org.springframework.boot.test.IntegrationTest源码实例Demo

下面列出了怎么用org.springframework.boot.test.IntegrationTest的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: mojito   文件: PollableTaskWSTest.java
@Test
@Category(IntegrationTest.class)
public void testGetPollableTask() throws Exception {

    String pollableTaskName = "testGetPollableTask";
    PollableTask parentTask = pollableTaskService.createPollableTask(null, pollableTaskName, null, 0);
    com.box.l10n.mojito.rest.entity.PollableTask pollableTask = pollableTaskClient.getPollableTask(parentTask.getId());

    assertEquals(pollableTaskName, pollableTask.getName());
    assertNull(pollableTask.getFinishedDate());
    assertFalse(pollableTask.isAllFinished());
}
 
/**
 * Configures the context in such a way that the service registy server has a
 * new unique port, and all provided application contexts are configured to
 * use it. It also copies properites provided in {@link RatelTest#value()} and
 * {@link IntegrationTest#value()} annotations.
 *
 * @param testContext
 *          the TestContext of a test
 */
@Override
public void prepareTestInstance(TestContext testContext) {

  applyPropertiesFromAnnotation(testContext, IntegrationTest.class.getName());
  applyPropertiesFromAnnotation(testContext, RatelTest.class.getName());

  int servicePort = RatelTestContext.getServiceDiscoveryPort(); // hardcoded, can
                                                             // be changed to
                                                             // finding free
                                                             // tcp port
  applyServiceRegistryProperties(testContext, servicePort);
}
 
private void addIntegrationTestProperty(Collection<String> propertySourceProperties) {
  propertySourceProperties.add(IntegrationTest.class.getName() + "=true");
}
 
 类所在包
 类方法
 同包方法