Package io.beanmapper.spring.web.mockmvc
Class MockEntityFinder
java.lang.Object
io.beanmapper.spring.web.mockmvc.MockEntityFinder
- All Implemented Interfaces:
EntityFinder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRepository
(org.springframework.data.repository.CrudRepository<? extends org.springframework.data.domain.Persistable<Long>, Long> repository, Class<?> entityClass) <T> T
Returns the entity on the basis of the entity class and its ID.<T> T
findAndDetach
(Long id, Class<T> entityClass) Returns the entity on the basis of the entity class and its ID bypassing the Hibernate cache
-
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 interfaceEntityFinder
- Parameters:
id
- the ID of the entityentityClass
- the class of the entity- Returns:
- the entity if found
- Throws:
jakarta.persistence.EntityNotFoundException
- if the repository or the entity could not be foundio.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 interfaceEntityFinder
- Parameters:
id
- the ID of the entityentityClass
- the class of the entity- Returns:
- the entity if found
- Throws:
jakarta.persistence.EntityNotFoundException
- if the repository or the entity could not be foundio.beanmapper.exceptions.BeanConstructException
-
addRepository
-