Esempio n. 1
0
  /**
   * Set up the test by creating a test container instance, {@link TestContainer#start() starting}
   * it and by creating a new {@link #configureClient(org.glassfish.jersey.client.ClientConfig)
   * pre-configured} test client. The test container is obtained from the {@link
   * #getTestContainerFactory() test container factory}.
   *
   * @throws TestContainerException if the default test container factory cannot be obtained, or the
   *     test application deployment context is not supported by the test container factory.
   * @throws Exception if an exception is thrown during setting up the test environment.
   */
  @Before
  public void setUp() throws Exception {
    if (isLogRecordingEnabled()) {
      registerLogHandler();
    }

    final TestContainer testContainer = createTestContainer(context);

    // Set current instance of test container and start it.
    setTestContainer(testContainer);
    testContainer.start();

    // Create an set new client.
    setClient(getClient(testContainer.getClientConfig()));
  }