mirror of
https://github.com/google/nomulus.git
synced 2025-08-06 01:35:17 +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
|
@ -20,7 +20,6 @@ import static google.registry.testing.DatastoreHelper.persistResource;
|
|||
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
import static google.registry.testing.TestDataHelper.loadFile;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
@ -108,7 +107,7 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
|||
.containsExactly(
|
||||
"status", "SUCCESS",
|
||||
"message", "Success",
|
||||
"results", asList(loadRegistrar(CLIENT_ID).toJsonMap()));
|
||||
"results", ImmutableList.of(loadRegistrar(CLIENT_ID).toJsonMap()));
|
||||
assertMetric(CLIENT_ID, "read", "[OWNER]", "SUCCESS");
|
||||
}
|
||||
|
||||
|
@ -164,7 +163,7 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
|||
assertThat(response).containsExactly(
|
||||
"status", "SUCCESS",
|
||||
"message", "Saved TheRegistrar",
|
||||
"results", asList(loadRegistrar(CLIENT_ID).toJsonMap()));
|
||||
"results", ImmutableList.of(loadRegistrar(CLIENT_ID).toJsonMap()));
|
||||
assertMetric(CLIENT_ID, "update", "[OWNER]", "SUCCESS");
|
||||
}
|
||||
|
||||
|
@ -285,7 +284,7 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
|||
// This role is authorized to perform this change, make sure the change succeeded
|
||||
// We got a success result:
|
||||
assertThat(response).containsEntry("status", "SUCCESS");
|
||||
assertThat(response).containsEntry("results", asList(updatedRegistrar.toJsonMap()));
|
||||
assertThat(response).containsEntry("results", ImmutableList.of(updatedRegistrar.toJsonMap()));
|
||||
// The updatedRegistrar had its value changed:
|
||||
// (We check it separately from the next assert to get better error message on failure)
|
||||
assertThat(getter.apply(updatedRegistrar)).isEqualTo(newValue);
|
||||
|
@ -467,7 +466,7 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
|
|||
.containsExactly(
|
||||
"status", "SUCCESS",
|
||||
"message", "Saved TheRegistrar",
|
||||
"results", asList(loadRegistrar(CLIENT_ID).toJsonMap()));
|
||||
"results", ImmutableList.of(loadRegistrar(CLIENT_ID).toJsonMap()));
|
||||
assertMetric(CLIENT_ID, "update", "[OWNER]", "SUCCESS");
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ import static google.registry.testing.CertificateSamples.SAMPLE_CERT_HASH;
|
|||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import java.util.Map;
|
||||
|
@ -52,7 +52,7 @@ public class SecuritySettingsTest extends RegistrarSettingsActionTestCase {
|
|||
"id", CLIENT_ID,
|
||||
"args", modified.toJsonMap()));
|
||||
assertThat(response).containsEntry("status", "SUCCESS");
|
||||
assertThat(response).containsEntry("results", asList(modified.toJsonMap()));
|
||||
assertThat(response).containsEntry("results", ImmutableList.of(modified.toJsonMap()));
|
||||
assertThat(loadRegistrar(CLIENT_ID)).isEqualTo(modified);
|
||||
assertMetric(CLIENT_ID, "update", "[OWNER]", "SUCCESS");
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ package google.registry.ui.server.registrar;
|
|||
import static com.google.common.base.Strings.repeat;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
@ -59,7 +58,7 @@ public class WhoisSettingsTest extends RegistrarSettingsActionTestCase {
|
|||
action.handleJsonRequest(
|
||||
ImmutableMap.of("op", "update", "id", CLIENT_ID, "args", modified.toJsonMap()));
|
||||
assertThat(response.get("status")).isEqualTo("SUCCESS");
|
||||
assertThat(response.get("results")).isEqualTo(asList(modified.toJsonMap()));
|
||||
assertThat(response.get("results")).isEqualTo(ImmutableList.of(modified.toJsonMap()));
|
||||
assertThat(loadRegistrar(CLIENT_ID)).isEqualTo(modified);
|
||||
assertMetric(CLIENT_ID, "update", "[OWNER]", "SUCCESS");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue