@@ -0,0 +1,2102 @@
+// Copyright 2020 The Nomulus Authors. All Rights Reserved.%0A//%0A// Licensed under the Apache License, Version 2.0 (the %22License%22);%0A// you may not use this file except in compliance with the License.%0A// You may obtain a copy of the License at%0A//%0A//     http://www.apache.org/licenses/LICENSE-2.0%0A//%0A// Unless required by applicable law or agreed to in writing, software%0A// distributed under the License is distributed on an %22AS IS%22 BASIS,%0A// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A// See the License for the specific language governing permissions and%0A// limitations under the License.%0A%0Apackage google.registry.persistence.transaction;%0A%0Aimport static com.google.common.truth.Truth.assertThat;%0Aimport static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;%0Aimport static java.nio.charset.StandardCharsets.UTF_8;%0A%0Aimport google.registry.persistence.transaction.JpaTestRules.JpaUnitTestRule;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.PrintStream;%0Aimport java.io.UnsupportedEncodingException;%0Aimport org.junit.jupiter.api.AfterEach;%0Aimport org.junit.jupiter.api.BeforeEach;%0Aimport org.junit.jupiter.api.Test;%0Aimport org.junit.jupiter.api.extension.RegisterExtension;%0A%0A/** Unit test for %7B@link JpaTestRules.Builder#withSqlLogging()%7D. */%0Apublic class JpaTestRulesSqlLoggingTest %7B%0A%0A  // Entity under test: configured to log SQL statements to Stdout.%0A  @RegisterExtension%0A  JpaUnitTestRule jpaRule = new JpaTestRules.Builder().withSqlLogging().buildUnitTestRule();%0A%0A  private PrintStream orgStdout;%0A  private ByteArrayOutputStream stdoutBuffer;%0A%0A  @BeforeEach%0A  public void beforeEach() %7B%0A    orgStdout = System.out;%0A    System.setOut(new PrintStream(stdoutBuffer = new ByteArrayOutputStream()));%0A  %7D%0A%0A  @AfterEach%0A  public void afterEach() %7B%0A    System.setOut(orgStdout);%0A  %7D%0A%0A  @Test%0A  void sqlLog_displayed() throws UnsupportedEncodingException %7B%0A    jpaTm()%0A        .transact(() -%3E jpaTm().getEntityManager().createNativeQuery(%22select 1%22).getSingleResult());%0A    assertThat(stdoutBuffer.toString(UTF_8.name())).contains(%22select 1%22);%0A  %7D%0A%7D%0A

Add a test for SQL logging config (#598)