From 96faa3cad76d0fbbc61cae5e0f35e1f4064899c1 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 24 Oct 2018 11:15:55 +0200 Subject: [PATCH] simplify declaration of test data --- .../sonia/scm/web/i18n/I18nServletTest.java | 66 ++++++++++--------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/scm-webapp/src/test/java/sonia/scm/web/i18n/I18nServletTest.java b/scm-webapp/src/test/java/sonia/scm/web/i18n/I18nServletTest.java index 6f0e0d07d9..a912f738e2 100644 --- a/scm-webapp/src/test/java/sonia/scm/web/i18n/I18nServletTest.java +++ b/scm-webapp/src/test/java/sonia/scm/web/i18n/I18nServletTest.java @@ -39,11 +39,7 @@ import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.Silent.class) @SubjectAware(configuration = "classpath:sonia/scm/shiro-001.ini") @@ -52,31 +48,41 @@ public class I18nServletTest { @Rule public ShiroRule shiro = new ShiroRule(); - private static final String GIT_PLUGIN_JSON = "{\n" + - " \"scm-git-plugin\": {\n" + - " \"information\": {\n" + - " \"clone\" : \"Clone\",\n" + - " \"create\" : \"Create\",\n" + - " \"replace\" : \"Push\"\n" + - " }\n" + - " }\n" + - "}"; - private static final String HG_PLUGIN_JSON = "{\n" + - " \"scm-hg-plugin\": {\n" + - " \"information\": {\n" + - " \"clone\" : \"Clone\",\n" + - " \"create\" : \"Create\",\n" + - " \"replace\" : \"Push\"\n" + - " }\n" + - " }\n" + - "}"; - private static String SVN_PLUGIN_JSON = "{\n" + - " \"scm-svn-plugin\": {\n" + - " \"information\": {\n" + - " \"checkout\" : \"Checkout\"\n" + - " }\n" + - " }\n" + - "}"; + private static final String GIT_PLUGIN_JSON = json( + "{", + "'scm-git-plugin': {", + "'information': {", + "'clone' : 'Clone',", + "'create' : 'Create',", + "'replace' : 'Push'", + "}", + "}", + "}" + ); + private static final String HG_PLUGIN_JSON = json( + "{", + "'scm-hg-plugin': {", + "'information': {", + "'clone' : 'Clone',", + "'create' : 'Create',", + "'replace' : 'Push'", + "}", + "}", + "}" + ); + private static String SVN_PLUGIN_JSON = json( + "{", + "'scm-svn-plugin': {", + "'information': {", + "'checkout' : 'Checkout'", + "}", + "}", + "}" + ); + + private static String json(String... parts) { + return String.join("\n", parts ).replaceAll("'", "\""); + } @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder();