Avoid using 'objectUnderTest' term in GitHubOAuthConfigTest
Change-Id: Ifaf07fca75b55dd86c8999533b3abca23f4e288c
diff --git a/github-oauth/src/test/java/com/googlesource/gerrit/plugins/github/oauth/GitHubOAuthConfigTest.java b/github-oauth/src/test/java/com/googlesource/gerrit/plugins/github/oauth/GitHubOAuthConfigTest.java
index aae8fcc..9f90c56 100644
--- a/github-oauth/src/test/java/com/googlesource/gerrit/plugins/github/oauth/GitHubOAuthConfigTest.java
+++ b/github-oauth/src/test/java/com/googlesource/gerrit/plugins/github/oauth/GitHubOAuthConfigTest.java
@@ -71,12 +71,10 @@
config.setString(CONF_KEY_SECTION, keySubsection, CIPHER_ALGO_CONFIG_LABEL, cipherAlgorithm);
config.setString(CONF_KEY_SECTION, keySubsection, SECRET_KEY_CONFIG_LABEL, secretKeyAlgorithm);
- GitHubOAuthConfig objectUnderTest = objectUnderTest();
-
- assertEquals(objectUnderTest.getCurrentKeyConfig().isCurrent(), true);
- assertEquals(objectUnderTest.getCurrentKeyConfig().getCipherAlgorithm(), cipherAlgorithm);
- assertEquals(objectUnderTest.getCurrentKeyConfig().getSecretKeyAlgorithm(), secretKeyAlgorithm);
- assertEquals(objectUnderTest.getCurrentKeyConfig().getKeyId(), keySubsection);
+ assertEquals(githubOAuthConfig().getCurrentKeyConfig().isCurrent(), true);
+ assertEquals(githubOAuthConfig().getCurrentKeyConfig().getCipherAlgorithm(), cipherAlgorithm);
+ assertEquals(githubOAuthConfig().getCurrentKeyConfig().getSecretKeyAlgorithm(), secretKeyAlgorithm);
+ assertEquals(githubOAuthConfig().getCurrentKeyConfig().getKeyId(), keySubsection);
}
@Test
@@ -90,7 +88,7 @@
config.setString(
CONF_KEY_SECTION, someOtherKeyConfig, PASSWORD_DEVICE_CONFIG_LABEL, testPasswordDevice);
- assertEquals(objectUnderTest().getCurrentKeyConfig().getKeyId(), currentKeyConfig);
+ assertEquals(githubOAuthConfig().getCurrentKeyConfig().getKeyId(), currentKeyConfig);
}
@Test
@@ -104,16 +102,14 @@
config.setString(
CONF_KEY_SECTION, someOtherKeyConfig, PASSWORD_DEVICE_CONFIG_LABEL, testPasswordDevice);
- GitHubOAuthConfig objectUnderTest = objectUnderTest();
-
- assertEquals(objectUnderTest.getKeyConfig(currentKeyConfig).getKeyId(), currentKeyConfig);
- assertEquals(objectUnderTest.getKeyConfig(someOtherKeyConfig).getKeyId(), someOtherKeyConfig);
+ assertEquals(githubOAuthConfig().getKeyConfig(currentKeyConfig).getKeyId(), currentKeyConfig);
+ assertEquals(githubOAuthConfig().getKeyConfig(someOtherKeyConfig).getKeyId(), someOtherKeyConfig);
}
@Test
public void shouldThrowWhenNoKeyIdIsConfigured() {
IllegalStateException illegalStateException =
- assertThrows(IllegalStateException.class, this::objectUnderTest);
+ assertThrows(IllegalStateException.class, this::githubOAuthConfig);
assertEquals(
illegalStateException.getMessage(),
@@ -126,7 +122,7 @@
public void shouldThrowWhenNoKeyConfigIsSetAsCurrent() {
config.setBoolean(CONF_KEY_SECTION, "someKeyConfig", CURRENT_CONFIG_LABEL, false);
- assertThrows(IllegalStateException.class, this::objectUnderTest);
+ assertThrows(IllegalStateException.class, this::githubOAuthConfig);
}
@Test
@@ -135,7 +131,7 @@
config.setBoolean(CONF_KEY_SECTION, invalidSubsection, CURRENT_CONFIG_LABEL, false);
IllegalStateException illegalStateException =
- assertThrows(IllegalStateException.class, this::objectUnderTest);
+ assertThrows(IllegalStateException.class, this::githubOAuthConfig);
assertEquals(
illegalStateException.getMessage(),
@@ -149,7 +145,7 @@
config.setBoolean(CONF_KEY_SECTION, "someKeyConfig", CURRENT_CONFIG_LABEL, true);
config.setBoolean(CONF_KEY_SECTION, "someOtherKeyConfig", CURRENT_CONFIG_LABEL, true);
- assertThrows(IllegalStateException.class, this::objectUnderTest);
+ assertThrows(IllegalStateException.class, this::githubOAuthConfig);
}
@Test
@@ -158,7 +154,7 @@
config.setBoolean(CONF_KEY_SECTION, someKeyConfig, CURRENT_CONFIG_LABEL, true);
IllegalStateException illegalStateException =
- assertThrows(IllegalStateException.class, this::objectUnderTest);
+ assertThrows(IllegalStateException.class, this::githubOAuthConfig);
assertEquals(
String.format(
@@ -170,7 +166,7 @@
@Test
public void shouldReturnEmptyCookieDomainByDefault() {
setupEncryptionConfig();
- assertEquals(Optional.empty(), objectUnderTest().getCookieDomain());
+ assertEquals(Optional.empty(), githubOAuthConfig().getCookieDomain());
}
@Test
@@ -179,10 +175,10 @@
String myDomain = ".mydomain.com";
config.setString("auth", null, "cookieDomain", myDomain);
- assertEquals(Optional.of(myDomain), objectUnderTest().getCookieDomain());
+ assertEquals(Optional.of(myDomain), githubOAuthConfig().getCookieDomain());
}
- private GitHubOAuthConfig objectUnderTest() {
+ private GitHubOAuthConfig githubOAuthConfig() {
return new GitHubOAuthConfig(config, canonicalWebUrl);
}