mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +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
|
@ -25,7 +25,6 @@ import static google.registry.backup.ExportCommitLogDiffAction.DIFF_FILE_PREFIX;
|
|||
import static google.registry.model.ofy.CommitLogBucket.getBucketIds;
|
||||
import static google.registry.model.ofy.CommitLogBucket.getBucketKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
import com.google.appengine.api.datastore.DatastoreServiceFactory;
|
||||
|
@ -135,7 +134,7 @@ public class RestoreCommitLogsActionTest {
|
|||
assertExpectedIds("previous to keep", "b", "d", "e", "f");
|
||||
assertInDatastore(file1CommitLogs);
|
||||
assertInDatastore(file2CommitLogs);
|
||||
assertInDatastore(asList(CommitLogCheckpointRoot.create(now)));
|
||||
assertInDatastore(CommitLogCheckpointRoot.create(now));
|
||||
assertCommitLogBuckets(ImmutableMap.of(1, now.minusMinutes(1), 2, now.minusMinutes(2)));
|
||||
}
|
||||
|
||||
|
@ -149,7 +148,7 @@ public class RestoreCommitLogsActionTest {
|
|||
ofy().clearSessionCache();
|
||||
assertExpectedIds("previous to keep");
|
||||
assertInDatastore(commitLogs);
|
||||
assertInDatastore(asList(CommitLogCheckpointRoot.create(now)));
|
||||
assertInDatastore(CommitLogCheckpointRoot.create(now));
|
||||
assertCommitLogBuckets(ImmutableMap.of());
|
||||
}
|
||||
|
||||
|
@ -168,7 +167,7 @@ public class RestoreCommitLogsActionTest {
|
|||
ofy().clearSessionCache();
|
||||
assertExpectedIds("previous to keep", "a", "b");
|
||||
assertInDatastore(commitLogs);
|
||||
assertInDatastore(asList(CommitLogCheckpointRoot.create(now)));
|
||||
assertInDatastore(CommitLogCheckpointRoot.create(now));
|
||||
assertCommitLogBuckets(ImmutableMap.of(1, now));
|
||||
}
|
||||
|
||||
|
@ -188,7 +187,7 @@ public class RestoreCommitLogsActionTest {
|
|||
ofy().clearSessionCache();
|
||||
assertExpectedIds("previous to keep");
|
||||
assertInDatastore(commitLogs);
|
||||
assertInDatastore(asList(CommitLogCheckpointRoot.create(now)));
|
||||
assertInDatastore(CommitLogCheckpointRoot.create(now));
|
||||
assertCommitLogBuckets(ImmutableMap.of(1, now));
|
||||
}
|
||||
|
||||
|
@ -205,7 +204,7 @@ public class RestoreCommitLogsActionTest {
|
|||
ofy().clearSessionCache();
|
||||
assertExpectedIds("previous to keep");
|
||||
assertInDatastore(commitLogs);
|
||||
assertInDatastore(asList(CommitLogCheckpointRoot.create(now)));
|
||||
assertInDatastore(CommitLogCheckpointRoot.create(now));
|
||||
assertCommitLogBuckets(ImmutableMap.of(1, now));
|
||||
}
|
||||
|
||||
|
@ -222,7 +221,7 @@ public class RestoreCommitLogsActionTest {
|
|||
ofy().clearSessionCache();
|
||||
assertThat(ofy().load().entity(TestObject.create("existing")).now().getField()).isEqualTo("b");
|
||||
assertInDatastore(commitLogs);
|
||||
assertInDatastore(asList(CommitLogCheckpointRoot.create(now)));
|
||||
assertInDatastore(CommitLogCheckpointRoot.create(now));
|
||||
assertCommitLogBuckets(ImmutableMap.of(1, now));
|
||||
}
|
||||
|
||||
|
@ -242,7 +241,7 @@ public class RestoreCommitLogsActionTest {
|
|||
assertExpectedIds("previous to keep");
|
||||
assertInDatastore(commitLogs);
|
||||
assertCommitLogBuckets(ImmutableMap.of(1, now));
|
||||
assertInDatastore(asList(CommitLogCheckpointRoot.create(now)));
|
||||
assertInDatastore(CommitLogCheckpointRoot.create(now));
|
||||
}
|
||||
|
||||
private CommitLogCheckpoint createCheckpoint(DateTime now) {
|
||||
|
@ -280,6 +279,10 @@ public class RestoreCommitLogsActionTest {
|
|||
.containsExactly((Object[]) ids);
|
||||
}
|
||||
|
||||
private void assertInDatastore(ImmutableObject entity) {
|
||||
assertThat(ofy().load().entity(entity).now()).isEqualTo(entity);
|
||||
}
|
||||
|
||||
private void assertInDatastore(Iterable<? extends ImmutableObject> entities) {
|
||||
assertThat(ofy().load().entities(entities).values()).containsExactlyElementsIn(entities);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue