use of org.wso2.carbon.apimgt.core.models.policy.SubscriptionPolicy in project carbon-apimgt by wso2.
the class TestMappingUtilTestCase method testSubscriptionToSubscriptionDTOMapping.
@Test(description = "Subscription to Subscription DTO mapping")
void testSubscriptionToSubscriptionDTOMapping() {
Policy subscriptionPolicy = SampleTestObjectCreator.goldSubscriptionPolicy;
API api = SampleTestObjectCreator.createDefaultAPI().build();
Application application = SampleTestObjectCreator.createDefaultApplication();
String uuid = UUID.randomUUID().toString();
Subscription subscription = new Subscription(uuid, application, api, subscriptionPolicy);
subscription.setStatus(APIMgtConstants.SubscriptionStatus.ACTIVE);
SubscriptionDTO subscriptionDTO = MappingUtil.fromSubscription(subscription);
assertEquals(subscription.getId(), subscriptionDTO.getSubscriptionId());
assertEquals(subscription.getStatus().name(), subscriptionDTO.getSubscriptionStatus().name());
assertEquals(subscription.getApplication().getId(), subscriptionDTO.getApplicationInfo().getApplicationId());
assertEquals(subscription.getPolicy().getPolicyName(), subscriptionDTO.getPolicy());
}
Aggregations