From 3b340a92ed27c84876b0606cf7b90aaf19d23779 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 27 Oct 2022 18:24:28 +0200 Subject: [PATCH] final ContextUnitTest.defineContextQueryString --- .../hsadminng/context/ContextUnitTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test/java/net/hostsharing/hsadminng/context/ContextUnitTest.java b/src/test/java/net/hostsharing/hsadminng/context/ContextUnitTest.java index 6cb0368b..5197973f 100644 --- a/src/test/java/net/hostsharing/hsadminng/context/ContextUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/context/ContextUnitTest.java @@ -26,7 +26,7 @@ import static org.mockito.Mockito.verify; @ExtendWith(MockitoExtension.class) class ContextUnitTest { - private String defineContextQueryString = """ + private static final String DEFINE_CONTEXT_QUERY_STRING = """ call defineContext( cast(:currentTask as varchar), cast(:currentRequest as varchar), @@ -58,7 +58,7 @@ class ContextUnitTest { context.define("current-user"); - verify(em).createNativeQuery(defineContextQueryString); + verify(em).createNativeQuery(DEFINE_CONTEXT_QUERY_STRING); verify(nativeQuery).setParameter( "currentTask", "WithoutHttpRequest.registerWithoutHttpServletRequestUsesCallStackForTask"); @@ -70,7 +70,7 @@ class ContextUnitTest { context.define("current-user"); - verify(em).createNativeQuery(defineContextQueryString); + verify(em).createNativeQuery(DEFINE_CONTEXT_QUERY_STRING); verify(nativeQuery).setParameter("currentRequest", ""); } } @@ -115,7 +115,7 @@ class ContextUnitTest { context.define("current-user"); - verify(em).createNativeQuery(defineContextQueryString); + verify(em).createNativeQuery(DEFINE_CONTEXT_QUERY_STRING); verify(nativeQuery).setParameter("currentTask", "POST http://localhost:9999/api/endpoint"); } @@ -129,7 +129,7 @@ class ContextUnitTest { context.define("current-user"); - verify(em).createNativeQuery(defineContextQueryString); + verify(em).createNativeQuery(DEFINE_CONTEXT_QUERY_STRING); verify(nativeQuery).setParameter("currentRequest", """ curl -0 -v -X POST http://localhost:9999/api/endpoint \\ -H 'current-user:given-user' \\ @@ -152,7 +152,7 @@ class ContextUnitTest { context.define("current-user"); - verify(em).createNativeQuery(defineContextQueryString); + verify(em).createNativeQuery(DEFINE_CONTEXT_QUERY_STRING); verify(nativeQuery).setParameter(eq("currentTask"), argThat((String t) -> t.length() == 96)); } @@ -171,7 +171,7 @@ class ContextUnitTest { context.define("current-user"); - verify(em).createNativeQuery(defineContextQueryString); + verify(em).createNativeQuery(DEFINE_CONTEXT_QUERY_STRING); verify(nativeQuery).setParameter(eq("currentRequest"), argThat((String t) -> t.length() == 512)); }