mirror of
https://github.com/google/nomulus.git
synced 2025-05-20 11:19:35 +02:00
Fix some issues caught by IntelliJ static code analysis
The most common issues were: * Arrays.asList() shouldn't be called with a single parameter. * Broken Javadoc @links. * Unnecessary casts and type declarations. * Unnecessary unused variable initializations. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=230994311
This commit is contained in:
parent
3cf26ff9b6
commit
c6e58d3bff
39 changed files with 132 additions and 165 deletions
|
@ -30,7 +30,6 @@ import static org.joda.time.DateTimeZone.UTC;
|
|||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import com.google.common.collect.Streams;
|
||||
|
@ -173,29 +172,6 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
|||
assertThat(ofy().load().type(HistoryEntry.class)).isEmpty();
|
||||
}
|
||||
|
||||
public <T> T getOnlyGlobalResource(Class<T> clazz) {
|
||||
return Iterables.getOnlyElement(ofy().load().type(clazz));
|
||||
}
|
||||
|
||||
/** Helper to remove the grace period's billing event key to facilitate comparison. */
|
||||
/** A helper class that sets the billing event parent history entry to facilitate comparison. */
|
||||
public static class BillingEventParentSetter implements Function<BillingEvent, BillingEvent> {
|
||||
private HistoryEntry historyEntry;
|
||||
|
||||
public static BillingEventParentSetter withParent(HistoryEntry historyEntry) {
|
||||
BillingEventParentSetter instance = new BillingEventParentSetter();
|
||||
instance.historyEntry = historyEntry;
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BillingEvent apply(BillingEvent billingEvent) {
|
||||
return billingEvent.asBuilder().setParent(historyEntry).build();
|
||||
}
|
||||
|
||||
private BillingEventParentSetter() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to facilitate comparison of maps of GracePeriods to BillingEvents. This takes a map of
|
||||
* GracePeriods to BillingEvents and returns a map of the same entries that ignores the keys
|
||||
|
@ -340,7 +316,7 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
|||
String.format(
|
||||
"Invalid xml.\nExpected:\n%s\n\nActual:\n%s\n",
|
||||
xml,
|
||||
marshal(output, ValidationMode.LENIENT)),
|
||||
Arrays.toString(marshal(output, ValidationMode.LENIENT))),
|
||||
e);
|
||||
}
|
||||
// Clear the cache so that we don't see stale results in tests.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue