Class TestClientResponseCleanup

java.lang.Object
ru.vyarus.dropwizard.guice.test.client.builder.util.TestClientResponseCleanup
All Implemented Interfaces:
AutoCloseable

public class TestClientResponseCleanup extends Object implements AutoCloseable
Holds references to responses, wrapped with TestClientResponse because they might be not consumed and so not closed. This holder aggregates all such requests to close them after a test.

The holder itself is stored under the guicey configuration state. On state shutdown (after the test) close method would be called automatically, closing all stale resources.

Of course, this mechanism is not a guarantee for all cases when generic test methods used instead of guicey test extensions.

Since:
16.09.2025
  • Constructor Details

    • TestClientResponseCleanup

      public TestClientResponseCleanup()
  • Method Details

    • add

      public void add(jakarta.ws.rs.core.Response response)
      Register a response to clean up after the test.
      Parameters:
      response - response to cleanup
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception