Tidy up ExpandrecurringBillingEventsAction

Per nickfelt's suggestion on []
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127193451
This commit is contained in:
ctingue 2016-07-12 06:27:53 -07:00 committed by Ben McIlwain
parent 7b9752c99d
commit 2caba95d28
10 changed files with 12 additions and 41 deletions

View file

@ -241,11 +241,8 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
.filter(new Predicate<BillingEvent.OneTime>() {
@Override
public boolean apply(OneTime billingEvent) {
Key<? extends BillingEvent> cancellationMatchingBillingEvent =
billingEvent.getCancellationMatchingBillingEvent();
return cancellationMatchingBillingEvent != null
&& billingEvent.getCancellationMatchingBillingEvent().equals(
Key.create(recurringEvent));
return Key.create(recurringEvent)
.equals(billingEvent.getCancellationMatchingBillingEvent());
}})
.transform(new Function<OneTime, DateTime>() {
@Override

View file

@ -50,6 +50,7 @@ import google.registry.testing.EppLoader;
import google.registry.testing.FakeClock;
import google.registry.testing.FakeHttpSession;
import google.registry.testing.InjectRule;
import google.registry.testing.ShardableTestCase;
import google.registry.util.TypeUtils.TypeInstantiator;
import google.registry.xml.ValidationMode;
@ -68,7 +69,7 @@ import java.util.Map;
* @param <F> the flow type
*/
@RunWith(MockitoJUnitRunner.class)
public abstract class FlowTestCase<F extends Flow> {
public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
/** Whether to actually write to the datastore or just simulate. */
public enum CommitMode { LIVE, DRY_RUN }

View file

@ -136,7 +136,4 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
persistContactResource(false);
runFlow();
}
// Extra methods so the test runner doesn't produce empty shards.
@Test public void testNothing1() {}
}

View file

@ -163,8 +163,4 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
persistHostResource(false);
runFlow();
}
// Extra methods so the test runner doesn't produce empty shards.
@Test public void testNothing1() {}
}

View file

@ -25,6 +25,7 @@ import org.junit.Test;
/** Unit tests for {@link HelloFlow}. */
public class HelloFlowTest extends FlowTestCase<HelloFlow> {
@Test
public void testHello() throws Exception {
setEppInput("hello.xml");
@ -35,15 +36,4 @@ public class HelloFlowTest extends FlowTestCase<HelloFlow> {
"greeting_crr.xml",
ImmutableMap.of("DATE", clock.nowUtc().toString(dateTimeNoMillis()))));
}
// Extra methods so the test runner doesn't produce empty shards.
@Test
public void testNothing1() {}
@Test
public void testNothing2() {}
@Test
public void testNothing3() {}
}

View file

@ -52,8 +52,4 @@ public class LogoutFlowTest extends FlowTestCase<LogoutFlow> {
sessionMetadata.setClientId(null); // Turn off the implicit login
runFlow();
}
// Extra methods so the test runner doesn't produce empty shards.
@Test public void testNothing1() {}
@Test public void testNothing2() {}
}

View file

@ -26,11 +26,11 @@ import com.google.common.io.CharStreams;
import google.registry.keyring.api.Keyring;
import google.registry.testing.BouncyCastleProviderRule;
import google.registry.testing.GpgSystemCommandRule;
import google.registry.testing.ShardableTestCase;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.joda.time.DateTime;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
@ -47,7 +47,7 @@ import java.io.OutputStream;
/** GnuPG integration tests for {@link Ghostryde}. */
@RunWith(Theories.class)
@SuppressWarnings("resource")
public class GhostrydeGpgIntegrationTest {
public class GhostrydeGpgIntegrationTest extends ShardableTestCase {
@Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@ -170,7 +170,4 @@ public class GhostrydeGpgIntegrationTest {
return value;
}
}
@Test public void makeShardingWork1() {}
@Test public void makeShardingWork2() {}
}

View file

@ -27,6 +27,7 @@ import google.registry.model.registrar.RegistrarAddress;
import google.registry.testing.AppEngineRule;
import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule;
import google.registry.testing.ShardableTestCase;
import google.registry.xjc.rderegistrar.XjcRdeRegistrar;
import google.registry.xjc.rderegistrar.XjcRdeRegistrarAddrType;
import google.registry.xjc.rderegistrar.XjcRdeRegistrarPostalInfoEnumType;
@ -49,7 +50,7 @@ import java.io.ByteArrayOutputStream;
* some exceptional conditions.
*/
@RunWith(JUnit4.class)
public class RegistrarToXjcConverterTest {
public class RegistrarToXjcConverterTest extends ShardableTestCase {
@Rule
public final AppEngineRule appEngine = AppEngineRule.builder()
@ -147,6 +148,4 @@ public class RegistrarToXjcConverterTest {
public void testMarshal() throws Exception {
marshalStrict(RegistrarToXjcConverter.convert(registrar), new ByteArrayOutputStream(), UTF_8);
}
@Test public void makeShardingWork1() {}
}

View file

@ -27,13 +27,13 @@ import google.registry.keyring.api.Keyring;
import google.registry.testing.BouncyCastleProviderRule;
import google.registry.testing.GpgSystemCommandRule;
import google.registry.testing.Providers;
import google.registry.testing.ShardableTestCase;
import google.registry.util.FormattingLogger;
import org.bouncycastle.openpgp.PGPKeyPair;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.joda.time.DateTime;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
@ -51,7 +51,7 @@ import java.io.OutputStream;
/** GPG combinatorial integration tests for the Ryde classes. */
@RunWith(Theories.class)
@SuppressWarnings("resource")
public class RydeGpgIntegrationTest {
public class RydeGpgIntegrationTest extends ShardableTestCase {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
@ -281,7 +281,4 @@ public class RydeGpgIntegrationTest {
return value;
}
}
@Test public void makeShardingWork1() {}
@Test public void makeShardingWork2() {}
}

View file

@ -23,6 +23,7 @@ import org.junit.Test;
* sure that we never produces empty shards.
*/
public abstract class ShardableTestCase {
@Test
public void testNothing1() {}