Interface MapperFTUtil<E extends dev.daymor.sakuraboot.DataPresentation<I>,I extends Comparable<? super I> & Serializable,D extends dev.daymor.sakuraboot.DataPresentation<I>>
- Type Parameters:
E
- The entity type extendingDataPresentation
.I
- The ID of type Comparable and Serializable.D
- The DTO type extendingDataPresentation
.
- All Superinterfaces:
dev.daymor.sakuraboot.test.BasicDataTestUtil<E,
,I, D> dev.daymor.sakuraboot.test.BasicTestUtil<E,
,I> dev.daymor.sakuraboot.test.SuperDataITUtil<E,
,I, D> SuperFTUtil<E,
,I> dev.daymor.sakuraboot.test.SuperITUtil<E,
,I> dev.daymor.sakuraboot.test.SuperTestUtil<I>
public interface MapperFTUtil<E extends dev.daymor.sakuraboot.DataPresentation<I>,I extends Comparable<? super I> & Serializable,D extends dev.daymor.sakuraboot.DataPresentation<I>>
extends SuperFTUtil<E,I>, dev.daymor.sakuraboot.test.SuperDataITUtil<E,I,D>
The interface for all the utility functional test function. This interface
provides common functions for testing mapper class.
Example:
To create a concrete util class that inherits from MapperFTUtil
,
follow these steps:
Implements the MapperFTUtil
interface:
@Component public class YourFTUtil implements MapperFTUtil<YourEntity, YourIdType, YourDto> { private final GlobalSpecification globalSpecification; private final YourMapper yourMapper; @Autowired YourFTUtil(final GlobalSpecification globalSpecification, final YourMapper yourMapper) { this.globalSpecification = globalSpecification; this.yourMapper = yourMapper; } @Override public GlobalSpecification getGlobalSpecification() { return globalSpecification; } @Override public Optional<YourEntity> createValidation ErrorEntity(YourIdType id) { return YourEntity.builder().id(id).build(); // If your class don't have a builder you can use the constructor } @Override public Optional<YourDto> createValidationErrorDto(YourIdType id) { return YourDto.builder().id(id).build(); // If your class don't have a builder you can use the constructor } @Override public YourMapper getMapper() { return yourMapper; } }
- Since:
- 0.1.0
- See Also:
-
Field Summary
Fields inherited from interface dev.daymor.sakuraboot.test.functional.SuperFTUtil
CAMEL_CASE_PATTERN
-
Method Summary
Methods inherited from interface dev.daymor.sakuraboot.test.BasicDataTestUtil
getData, getDataClass, getDataWithoutId, getDifferentData, getPartialData, getSecondData
Methods inherited from interface dev.daymor.sakuraboot.test.BasicTestUtil
getDifferentEntity, getEntity, getEntityClass, getEntityWithoutId, getPartialEntity, getSecondEntity
Methods inherited from interface dev.daymor.sakuraboot.test.SuperDataITUtil
getDifferentDataWithId, getPartialDataWithId
Methods inherited from interface dev.daymor.sakuraboot.test.functional.SuperFTUtil
createValidationErrorEntity, getBiggerValidId, getControllerPackageName, getDtoPackageName, getEntityPackageName, getGlobalSpecification, getInvalidId, getMapperPackageName, getPath, getServicePackageName, getValidId
Methods inherited from interface dev.daymor.sakuraboot.test.SuperITUtil
getDifferentEntityWithId, getPartialEntityWithId
-
Method Details
-
getMapper
Get the mapper.- Returns:
- The mapper.
-
toDto
default dev.daymor.sakuraboot.DataPresentation<I> toDto(dev.daymor.sakuraboot.DataPresentation<I> entity) Converts an entity object to it's corresponding DTO object.- Parameters:
entity
- TheDataPresentation
object to convert.- Returns:
- The
DataPresentation
object representing the entity.
-