All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generator.server.springboot.cucumber.CucumberJpaReset.mustache Maven / Gradle / Ivy

There is a newer version: 1.23.0
Show newest version
package {{packageName}}.cucumber;

import io.cucumber.java.After;
import io.cucumber.java.Before;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;

public class CucumberJpaReset {

  private final Collection> repositories;

  CucumberJpaReset(@Autowired(required = false) Collection> repositories) {
    this.repositories = repositories;
  }

  @After
  @Before
  @Transactional
  public void wipeData() {
    if (repositories == null) {
      return;
    }

    repositories.forEach(JpaRepository::deleteAllInBatch);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy