mirror of
https://github.com/google/nomulus.git
synced 2025-07-10 21:23:22 +02:00
Don't use @RunWith JUnit annotations on classes with no @Tests
IntelliJ is complaining when this annotation is used on a base class that has no actual runnable tests itself. The solution is different for different classes depending on the existing pattern of where the @RunWith annotation is; for some, it's simplest to move the annotation down to the few extending classes that are missing it, whereas in others it's easiest just to annotate the base class as abstract.
This commit is contained in:
parent
d3f0d34e2b
commit
c50f16853b
9 changed files with 11 additions and 12 deletions
|
@ -48,7 +48,7 @@ import org.junit.runners.JUnit4;
|
||||||
|
|
||||||
/** Base class of all unit tests for entities which are persisted to Datastore via Objectify. */
|
/** Base class of all unit tests for entities which are persisted to Datastore via Objectify. */
|
||||||
@RunWith(JUnit4.class)
|
@RunWith(JUnit4.class)
|
||||||
public class EntityTestCase {
|
public abstract class EntityTestCase {
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public final AppEngineRule appEngine = AppEngineRule.builder()
|
public final AppEngineRule appEngine = AppEngineRule.builder()
|
||||||
|
|
|
@ -23,6 +23,7 @@ import google.registry.testing.EppLoader;
|
||||||
|
|
||||||
/** Unit tests for {@code ResourceCommand}. */
|
/** Unit tests for {@code ResourceCommand}. */
|
||||||
public abstract class ResourceCommandTestCase extends EntityTestCase {
|
public abstract class ResourceCommandTestCase extends EntityTestCase {
|
||||||
|
|
||||||
protected void doXmlRoundtripTest(String inputFilename, String... ignoredPaths)
|
protected void doXmlRoundtripTest(String inputFilename, String... ignoredPaths)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
EppLoader eppLoader = new EppLoader(this, inputFilename);
|
EppLoader eppLoader = new EppLoader(this, inputFilename);
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
/** Test xml roundtripping of commands. */
|
/** Test xml roundtripping of commands. */
|
||||||
public class HostCommandTest extends ResourceCommandTestCase {
|
public class HostCommandTest extends ResourceCommandTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreate() throws Exception {
|
public void testCreate() throws Exception {
|
||||||
doXmlRoundtripTest("host_create.xml");
|
doXmlRoundtripTest("host_create.xml");
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.joda.money.CurrencyUnit;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/** Unit tests for {@link Registrar}. */
|
/** Unit tests for {@link Registrar}. */
|
||||||
public class RegistrarTest extends EntityTestCase {
|
public class RegistrarTest extends EntityTestCase {
|
||||||
private Registrar registrar;
|
private Registrar registrar;
|
||||||
private RegistrarContact abuseAdminContact;
|
private RegistrarContact abuseAdminContact;
|
||||||
|
|
|
@ -41,12 +41,9 @@ import java.util.Optional;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.junit.runners.JUnit4;
|
|
||||||
|
|
||||||
/** Common unit test code for actions inheriting {@link RdapActionBase}. */
|
/** Common unit test code for actions inheriting {@link RdapActionBase}. */
|
||||||
@RunWith(JUnit4.class)
|
public abstract class RdapActionBaseTestCase<A extends RdapActionBase> {
|
||||||
public class RdapActionBaseTestCase<A extends RdapActionBase> {
|
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public final AppEngineRule appEngine = AppEngineRule.builder()
|
public final AppEngineRule appEngine = AppEngineRule.builder()
|
||||||
|
|
|
@ -24,8 +24,11 @@ import google.registry.rdap.RdapMetrics.WildcardType;
|
||||||
import google.registry.rdap.RdapSearchResults.IncompletenessWarningType;
|
import google.registry.rdap.RdapSearchResults.IncompletenessWarningType;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.JUnit4;
|
||||||
|
|
||||||
/** Unit tests for {@link RdapHelpAction}. */
|
/** Unit tests for {@link RdapHelpAction}. */
|
||||||
|
@RunWith(JUnit4.class)
|
||||||
public class RdapHelpActionTest extends RdapActionBaseTestCase<RdapHelpAction> {
|
public class RdapHelpActionTest extends RdapActionBaseTestCase<RdapHelpAction> {
|
||||||
|
|
||||||
public RdapHelpActionTest() {
|
public RdapHelpActionTest() {
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Optional;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
||||||
/** Common unit test code for actions inheriting {@link RdapSearchActionBase}. */
|
/** Common unit test code for actions inheriting {@link RdapSearchActionBase}. */
|
||||||
public class RdapSearchActionTestCase<A extends RdapSearchActionBase>
|
public abstract class RdapSearchActionTestCase<A extends RdapSearchActionBase>
|
||||||
extends RdapActionBaseTestCase<A> {
|
extends RdapActionBaseTestCase<A> {
|
||||||
|
|
||||||
protected RdapSearchActionTestCase(Class<A> rdapActionClass) {
|
protected RdapSearchActionTestCase(Class<A> rdapActionClass) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.mockito.junit.MockitoRule;
|
||||||
|
|
||||||
/** Common code for unit tests of classes that extend {@link Marksdb}. */
|
/** Common code for unit tests of classes that extend {@link Marksdb}. */
|
||||||
@RunWith(JUnit4.class)
|
@RunWith(JUnit4.class)
|
||||||
public class TmchActionTestCase {
|
public abstract class TmchActionTestCase {
|
||||||
|
|
||||||
static final String MARKSDB_LOGIN_AND_PASSWORD = "lolcat:attack";
|
static final String MARKSDB_LOGIN_AND_PASSWORD = "lolcat:attack";
|
||||||
static final String MARKSDB_URL = "http://127.0.0.1/love";
|
static final String MARKSDB_URL = "http://127.0.0.1/love";
|
||||||
|
|
|
@ -59,16 +59,13 @@ import org.joda.time.DateTime;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.junit.runners.JUnit4;
|
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.junit.MockitoJUnit;
|
import org.mockito.junit.MockitoJUnit;
|
||||||
import org.mockito.junit.MockitoRule;
|
import org.mockito.junit.MockitoRule;
|
||||||
|
|
||||||
/** Base class for tests using {@link RegistrarSettingsAction}. */
|
/** Base class for tests using {@link RegistrarSettingsAction}. */
|
||||||
@RunWith(JUnit4.class)
|
public abstract class RegistrarSettingsActionTestCase {
|
||||||
public class RegistrarSettingsActionTestCase {
|
|
||||||
|
|
||||||
static final String CLIENT_ID = "TheRegistrar";
|
static final String CLIENT_ID = "TheRegistrar";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue