Match exception message more exactly in test assertion

This commit is contained in:
Yannick Welsch 2016-07-02 10:07:12 +02:00
parent b4064ce43f
commit 3221c9d970
1 changed files with 4 additions and 2 deletions

View File

@ -40,6 +40,7 @@ import java.util.List;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.either;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
@ -153,8 +154,9 @@ public class RepositoriesIT extends AbstractSnapshotIntegTestCase {
.get(); .get();
fail("Shouldn't be here"); fail("Shouldn't be here");
} catch (RepositoryException ex) { } catch (RepositoryException ex) {
assertThat(ex.toString(), containsString("Unable to parse URL repository setting")); assertThat(ex.toString(),
assertThat(ex.toString(), containsString("netdoc")); either(containsString("unsupported url protocol [netdoc]"))
.or(containsString("unknown protocol: netdoc"))); // newer versions of JDK 9
} }
logger.info("--> trying creating url repository with location that is not registered in path.repo setting"); logger.info("--> trying creating url repository with location that is not registered in path.repo setting");