Reuse AssertUtil#assertPrefs in EditPreferencesIT
Release-Notes: skip
Google-Bug-Id: b/353555340
Change-Id: I060d71df00a39a87f811f13edeb950646fe6b363
diff --git a/java/com/google/gerrit/acceptance/AssertUtil.java b/java/com/google/gerrit/acceptance/AssertUtil.java
index a1d3e79..f72c6d3 100644
--- a/java/com/google/gerrit/acceptance/AssertUtil.java
+++ b/java/com/google/gerrit/acceptance/AssertUtil.java
@@ -25,9 +25,9 @@
public class AssertUtil {
public static <T> void assertPrefs(T actual, T expected, String... fieldsToExclude)
throws IllegalArgumentException, IllegalAccessException {
- Set<String> exludedFields = new HashSet<>(Arrays.asList(fieldsToExclude));
+ Set<String> excludedFields = new HashSet<>(Arrays.asList(fieldsToExclude));
for (Field field : actual.getClass().getDeclaredFields()) {
- if (exludedFields.contains(field.getName()) || skipField(field)) {
+ if (excludedFields.contains(field.getName()) || skipField(field)) {
continue;
}
Object actualVal = field.get(actual);
diff --git a/javatests/com/google/gerrit/acceptance/api/accounts/EditPreferencesIT.java b/javatests/com/google/gerrit/acceptance/api/accounts/EditPreferencesIT.java
index 6802333..74829a3 100644
--- a/javatests/com/google/gerrit/acceptance/api/accounts/EditPreferencesIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/accounts/EditPreferencesIT.java
@@ -15,6 +15,7 @@
package com.google.gerrit.acceptance.api.accounts;
import static com.google.common.truth.Truth.assertThat;
+import static com.google.gerrit.acceptance.AssertUtil.assertPrefs;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.NoHttpd;
@@ -60,7 +61,7 @@
EditPreferencesInfo info = gApi.accounts().id(admin.id().get()).setEditPreferences(out);
- assertEditPreferences(info, out);
+ assertPrefs(info, out);
// Partially filled input record
EditPreferencesInfo in = new EditPreferencesInfo();
@@ -69,24 +70,6 @@
info = gApi.accounts().id(admin.id().get()).setEditPreferences(in);
out.tabSize = in.tabSize;
- assertEditPreferences(info, out);
- }
-
- private void assertEditPreferences(EditPreferencesInfo out, EditPreferencesInfo in)
- throws Exception {
- assertThat(out.lineLength).isEqualTo(in.lineLength);
- assertThat(out.indentUnit).isEqualTo(in.indentUnit);
- assertThat(out.tabSize).isEqualTo(in.tabSize);
- assertThat(out.cursorBlinkRate).isEqualTo(in.cursorBlinkRate);
- assertThat(out.hideTopMenu).isEqualTo(in.hideTopMenu);
- assertThat(out.showTabs).isNull();
- assertThat(out.showWhitespaceErrors).isEqualTo(in.showWhitespaceErrors);
- assertThat(out.syntaxHighlighting).isNull();
- assertThat(out.hideLineNumbers).isEqualTo(in.hideLineNumbers);
- assertThat(out.matchBrackets).isNull();
- assertThat(out.lineWrapping).isEqualTo(in.lineWrapping);
- assertThat(out.indentWithTabs).isEqualTo(in.indentWithTabs);
- assertThat(out.autoCloseBrackets).isEqualTo(in.autoCloseBrackets);
- assertThat(out.showBase).isEqualTo(in.showBase);
+ assertPrefs(info, out);
}
}