Remove redundant "testName" methods from Elasticsearch tests

All the Elasticsearch test classes inherit from GerritBaseTests, which
has a getSanitizedMethodName method. Remove the testName methods defined
in all of the test classes, and use getSanitizedMethodName instead.

Change-Id: Ie834a087130fdecffd8bdc6eaa72fe53ab91d6eb
This commit is contained in:
David Pursehouse
2018-12-03 10:47:43 +09:00
parent b9c7c39e8b
commit 31ee321cd1
9 changed files with 9 additions and 45 deletions

View File

@@ -45,10 +45,6 @@ public class ElasticV5QueryAccountsTest extends AbstractQueryAccountsTest {
}
}
private String testName() {
return testName.getMethodName().toLowerCase() + "_";
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
@@ -59,7 +55,7 @@ public class ElasticV5QueryAccountsTest extends AbstractQueryAccountsTest {
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = testName();
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));

View File

@@ -45,10 +45,6 @@ public class ElasticV5QueryChangesTest extends AbstractQueryChangesTest {
}
}
private String testName() {
return testName.getMethodName().toLowerCase() + "_";
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
@@ -59,7 +55,7 @@ public class ElasticV5QueryChangesTest extends AbstractQueryChangesTest {
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = testName();
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));

View File

@@ -45,10 +45,6 @@ public class ElasticV5QueryGroupsTest extends AbstractQueryGroupsTest {
}
}
private String testName() {
return testName.getMethodName().toLowerCase() + "_";
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
@@ -59,7 +55,7 @@ public class ElasticV5QueryGroupsTest extends AbstractQueryGroupsTest {
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = testName();
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));

View File

@@ -45,10 +45,6 @@ public class ElasticV6QueryAccountsTest extends AbstractQueryAccountsTest {
}
}
private String testName() {
return testName.getMethodName().toLowerCase() + "_";
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
@@ -59,7 +55,7 @@ public class ElasticV6QueryAccountsTest extends AbstractQueryAccountsTest {
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = testName();
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}

View File

@@ -46,10 +46,6 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
}
}
private String testName() {
return testName.getMethodName().toLowerCase() + "_";
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
@@ -60,7 +56,7 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = testName();
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}

View File

@@ -45,10 +45,6 @@ public class ElasticV6QueryGroupsTest extends AbstractQueryGroupsTest {
}
}
private String testName() {
return testName.getMethodName().toLowerCase() + "_";
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
@@ -59,7 +55,7 @@ public class ElasticV6QueryGroupsTest extends AbstractQueryGroupsTest {
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = testName();
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}

View File

@@ -45,10 +45,6 @@ public class ElasticV7QueryAccountsTest extends AbstractQueryAccountsTest {
}
}
private String testName() {
return testName.getMethodName().toLowerCase() + "_";
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
@@ -59,7 +55,7 @@ public class ElasticV7QueryAccountsTest extends AbstractQueryAccountsTest {
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = testName();
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}

View File

@@ -46,10 +46,6 @@ public class ElasticV7QueryChangesTest extends AbstractQueryChangesTest {
}
}
private String testName() {
return testName.getMethodName().toLowerCase() + "_";
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
@@ -60,7 +56,7 @@ public class ElasticV7QueryChangesTest extends AbstractQueryChangesTest {
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = testName();
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}

View File

@@ -45,10 +45,6 @@ public class ElasticV7QueryGroupsTest extends AbstractQueryGroupsTest {
}
}
private String testName() {
return testName.getMethodName().toLowerCase() + "_";
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
@@ -59,7 +55,7 @@ public class ElasticV7QueryGroupsTest extends AbstractQueryGroupsTest {
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = testName();
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}