Class MockEntityFinder

java.lang.Object
io.beanmapper.spring.web.mockmvc.MockEntityFinder
All Implemented Interfaces:
EntityFinder

public class MockEntityFinder extends Object implements EntityFinder
  • Constructor Details

    • MockEntityFinder

      public MockEntityFinder()
  • Method Details

    • find

      public <T> T find(Long id, Class<T> entityClass) throws jakarta.persistence.EntityNotFoundException, io.beanmapper.exceptions.BeanConstructException
      Description copied from interface: EntityFinder
      Returns the entity on the basis of the entity class and its ID.
      Specified by:
      find in interface EntityFinder
      Parameters:
      id - the ID of the entity
      entityClass - the class of the entity
      Returns:
      the entity if found
      Throws:
      jakarta.persistence.EntityNotFoundException - if the repository or the entity could not be found
      io.beanmapper.exceptions.BeanConstructException
    • findAndDetach

      public <T> T findAndDetach(Long id, Class<T> entityClass) throws jakarta.persistence.EntityNotFoundException, io.beanmapper.exceptions.BeanConstructException
      Description copied from interface: EntityFinder
      Returns the entity on the basis of the entity class and its ID bypassing the Hibernate cache
      Specified by:
      findAndDetach in interface EntityFinder
      Parameters:
      id - the ID of the entity
      entityClass - the class of the entity
      Returns:
      the entity if found
      Throws:
      jakarta.persistence.EntityNotFoundException - if the repository or the entity could not be found
      io.beanmapper.exceptions.BeanConstructException
    • addRepository

      public void addRepository(org.springframework.data.repository.CrudRepository<? extends org.springframework.data.domain.Persistable<Long>,Long> repository, Class<?> entityClass)