Skip to content

Commit 62b270d

Browse files
kiviewrnorth
authored andcommitted
Add self-typing generics to ElasticsearchContainer (#963)
Fixes #962
1 parent 53e2657 commit 62b270d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

modules/elasticsearch/src/main/java/org/testcontainers/elasticsearch/ElasticsearchContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Represents an elasticsearch docker instance which exposes by default port 9200 and 9300 (transport.tcp.port)
1414
* The docker image is by default fetched from docker.elastic.co/elasticsearch/elasticsearch
1515
*/
16-
public class ElasticsearchContainer extends GenericContainer {
16+
public class ElasticsearchContainer extends GenericContainer<ElasticsearchContainer> {
1717

1818
/**
1919
* Elasticsearch Default HTTP port

modules/elasticsearch/src/test/java/org/testcontainers/elasticsearch/ElasticsearchContainerTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ public void stopRestClient() throws IOException {
4646

4747
@Test
4848
public void elasticsearchDefaultTest() throws IOException {
49-
try (ElasticsearchContainer container = new ElasticsearchContainer()){
49+
try (ElasticsearchContainer container = new ElasticsearchContainer()
50+
.withEnv("foo", "bar") // dummy env for compiler checking correct generics usage
51+
){
5052
container.start();
5153
Response response = getClient(container).performRequest(new Request("GET", "/"));
5254
assertThat(response.getStatusLine().getStatusCode(), is(200));

0 commit comments

Comments
 (0)