use of io.gravitee.rest.api.portal.rest.model.ReferenceMetadataInput in project gravitee-management-rest-api by gravitee-io.
the class ReferenceMetadataMapperTest method testConvertInputToNewMetadataEntity.
@Test
public void testConvertInputToNewMetadataEntity() {
// init
ReferenceMetadataInput metadataInput = new ReferenceMetadataInput();
metadataInput.setDefaultValue(METADATA_DEFAULT_VALUE);
metadataInput.setValue(METADATA_VALUE);
metadataInput.setFormat(ReferenceMetadataFormatType.valueOf(METADATA_FORMAT));
metadataInput.setName(METADATA_NAME);
// Test
final NewApplicationMetadataEntity newApplicationMetadataEntity = referenceMetadataMapper.convert(metadataInput, METADATA_APPLICATION_ID);
assertNotNull(newApplicationMetadataEntity);
assertEquals(METADATA_APPLICATION_ID, newApplicationMetadataEntity.getApplicationId());
assertEquals(METADATA_DEFAULT_VALUE, newApplicationMetadataEntity.getDefaultValue());
assertEquals(METADATA_NAME, newApplicationMetadataEntity.getName());
assertEquals(METADATA_VALUE, newApplicationMetadataEntity.getValue());
assertEquals(MetadataFormat.valueOf(METADATA_FORMAT), newApplicationMetadataEntity.getFormat());
}
use of io.gravitee.rest.api.portal.rest.model.ReferenceMetadataInput in project gravitee-management-rest-api by gravitee-io.
the class ReferenceMetadataMapperTest method testConvertInputToUpdateMetadataEntity.
@Test
public void testConvertInputToUpdateMetadataEntity() {
// init
ReferenceMetadataInput metadataInput = new ReferenceMetadataInput();
metadataInput.setDefaultValue(METADATA_DEFAULT_VALUE);
metadataInput.setValue(METADATA_VALUE);
metadataInput.setFormat(ReferenceMetadataFormatType.valueOf(METADATA_FORMAT));
metadataInput.setName(METADATA_NAME);
// Test
final UpdateApplicationMetadataEntity updateApplicationMetadataEntity = referenceMetadataMapper.convert(metadataInput, METADATA_APPLICATION_ID, METADATA_KEY);
assertNotNull(updateApplicationMetadataEntity);
assertEquals(METADATA_APPLICATION_ID, updateApplicationMetadataEntity.getApplicationId());
assertEquals(METADATA_DEFAULT_VALUE, updateApplicationMetadataEntity.getDefaultValue());
assertEquals(METADATA_NAME, updateApplicationMetadataEntity.getName());
assertEquals(METADATA_KEY, updateApplicationMetadataEntity.getKey());
assertEquals(METADATA_VALUE, updateApplicationMetadataEntity.getValue());
assertEquals(MetadataFormat.valueOf(METADATA_FORMAT), updateApplicationMetadataEntity.getFormat());
}
Aggregations