@@ -0,0 +1,1938 @@
+// 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.testing;%0A%0Aimport static com.google.common.truth.Truth.assertThat;%0Aimport static google.registry.persistence.transaction.TransactionManagerFactory.tm;%0A%0Aimport google.registry.model.ofy.DatastoreTransactionManager;%0Aimport google.registry.persistence.transaction.JpaTransactionManager;%0Aimport org.junit.jupiter.api.AfterAll;%0Aimport org.junit.jupiter.api.TestTemplate;%0Aimport org.junit.jupiter.api.extension.RegisterExtension;%0A%0A/**%0A * Test to verify that %7B@link DualDatabaseTestInvocationContextProvider%7D extension executes %7B@link%0A * TestTemplate%7D test twice with different databases.%0A */%0A@DualDatabaseTest%0Apublic class DualDatabaseTestInvocationContextProviderTest %7B%0A%0A  private static int datastoreTestCounter = 0;%0A  private static int postgresqlTestCounter = 0;%0A%0A  @RegisterExtension%0A  public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build();%0A%0A  @TestTemplate%0A  void testToUseTransactionManager() %7B%0A    if (tm() instanceof DatastoreTransactionManager) %7B%0A      datastoreTestCounter++;%0A    %7D%0A    if (tm() instanceof JpaTransactionManager) %7B%0A      postgresqlTestCounter++;%0A    %7D%0A  %7D%0A%0A  @AfterAll%0A  static void assertEachTransactionManagerIsUsed() %7B%0A    assertThat(datastoreTestCounter).isEqualTo(1);%0A    assertThat(postgresqlTestCounter).isEqualTo(1);%0A  %7D%0A%7D%0A

Add test to verify the behavior of @DualDatabaseTest (#606)