/*
 * Copyright 2019 Immutables Authors and Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.immutables.criteria.mongo;

import com.mongodb.reactivestreams.client.MongoDatabase;
import org.immutables.criteria.typemodel.BooleanTemplate;
import org.immutables.criteria.typemodel.LocalDateTemplate;
import org.immutables.criteria.typemodel.LongTemplate;
import org.immutables.criteria.typemodel.StringTemplate;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.extension.ExtendWith;

@ExtendWith(MongoExtension.class)
class MongoIntegrationTest {

  private final BackendResource backend;

  MongoIntegrationTest(MongoDatabase database) {
    this.backend = new BackendResource(database);
  }

  @Nested
  class String extends StringTemplate {
    private String() {
      super(backend.backend());
    }
  }

  @Nested
  class BooleanTest extends BooleanTemplate {
    private BooleanTest() {
      super(backend.backend());
    }
  }

  @Nested
  class LocalDateTest extends LocalDateTemplate {
    private LocalDateTest() {
      super(backend.backend());
    }
  }

  @Nested
  class LongTest extends LongTemplate {
    private LongTest() {
      super(backend.backend());
    }
  }

}

@@ -707,16 +707,64 @@
 tabase;%0A
+import org.immutables.criteria.backend.Backend;%0A
 import o
@@ -805,32 +805,32 @@
 ooleanTemplate;%0A
-
 import org.immut
@@ -1161,24 +1161,16 @@
  Backend
-Resource
  backend
@@ -1269,16 +1269,26 @@
 atabase)
+.backend()
 ;%0A  %7D%0A%0A 
@@ -1374,34 +1374,24 @@
 uper(backend
-.backend()
 );%0A    %7D%0A  %7D
@@ -1491,34 +1491,24 @@
 uper(backend
-.backend()
 );%0A    %7D%0A  %7D
@@ -1614,34 +1614,24 @@
 uper(backend
-.backend()
 );%0A    %7D%0A  %7D
@@ -1699,32 +1699,32 @@
 te LongTest() %7B%0A
+
       super(back
@@ -1726,26 +1726,16 @@
 (backend
-.backend()
 );%0A    %7D

Simplify MongoIntegrationTest setup