Skip to content

Commit

Permalink
Add self-typing generics to ElasticsearchContainer (#963)
Browse files Browse the repository at this point in the history
Fixes #962
  • Loading branch information
kiview authored and rnorth committed Nov 7, 2018
1 parent 53e2657 commit 62b270d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Represents an elasticsearch docker instance which exposes by default port 9200 and 9300 (transport.tcp.port)
* The docker image is by default fetched from docker.elastic.co/elasticsearch/elasticsearch
*/
public class ElasticsearchContainer extends GenericContainer {
public class ElasticsearchContainer extends GenericContainer<ElasticsearchContainer> {

/**
* Elasticsearch Default HTTP port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public void stopRestClient() throws IOException {

@Test
public void elasticsearchDefaultTest() throws IOException {
try (ElasticsearchContainer container = new ElasticsearchContainer()){
try (ElasticsearchContainer container = new ElasticsearchContainer()
.withEnv("foo", "bar") // dummy env for compiler checking correct generics usage
){
container.start();
Response response = getClient(container).performRequest(new Request("GET", "/"));
assertThat(response.getStatusLine().getStatusCode(), is(200));
Expand Down

0 comments on commit 62b270d

Please sign in to comment.