Skip to content

Cosium/synapse-junit-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Maven Central

Synapse Junit Extension

JUnit extension allowing to run tests against a real Synapse instance.

Usage

@EnableSynapse
class SynapseTest {
  @Test
  void test(Synapse synapse) throws IOException, InterruptedException {
    URI synapseUri = URI.create(synapse.url() + "/_matrix/static/");
    HttpResponse<String> response = HttpClient
      .newHttpClient()
      .send(
        HttpRequest.newBuilder(synapseUri).GET().build(),
	HttpResponse.BodyHandlers.ofString());

    assertThat(response.body()).contains("Synapse is running");
    assertThat(response.statusCode()).isEqualTo(200);
  }
}

For performance reasons, a single Synapse instance is shared with any test belonging to any class annotated with @EnableSynapse. Therefore, you can run a test suite containing as many test classes as you want, Synapse will be started only once. It will shutdown at the end of the JUnit runtime.

Dependency

<dependency>
  <groupId>com.cosium.synapse_junit_extension</groupId>
  <artifactId>synapse-junit-extension</artifactId>
  <version>${synapse-junit-extension.version}</version>
  <scope>test</scope>
</dependency>

Requirements

  • JDK 11+
  • Docker

About

JUnit extension allowing to run tests against a real Synapse instance

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy