package com.ning.billing.entitlement.api;
import java.util.UUID;
import org.mockito.Mockito;
import org.testng.Assert;
import org.testng.annotations.Test;
import com.ning.billing.account.api.Account;
import com.ning.billing.account.api.AccountApiException;
import com.ning.billing.account.api.AccountUserApi;
import com.ning.billing.catalog.api.BillingPeriod;
import com.ning.billing.catalog.api.PlanPhaseSpecifier;
import com.ning.billing.catalog.api.PriceListSet;
import com.ning.billing.catalog.api.ProductCategory;
import com.ning.billing.entitlement.EntitlementTestSuiteWithEmbeddedDB;
import com.ning.billing.util.callcontext.InternalTenantContext;
import com.ning.billing.util.callcontext.TenantContext;
public class TestDefaultEntitlementApi extends EntitlementTestSuiteWithEmbeddedDB {
@Test(groups = "slow")
public void test1() {
try {
final UUID accountId = UUID.randomUUID();
final String externalKey = "externalKey";
final Account account = Mockito.mock(Account.class);
Mockito.when(account.getId()).thenReturn(accountId);
Mockito.when(accountInternalApi.getAccountById(Mockito.<UUID>any(), Mockito.<InternalTenantContext>any())).thenReturn(account);
final PlanPhaseSpecifier spec = new PlanPhaseSpecifier("Shotgun", ProductCategory.BASE, BillingPeriod.MONTHLY, PriceListSet.DEFAULT_PRICELIST_NAME, null);
entitlementApi.createBaseEntitlement(accountId, spec, externalKey, callContext);
} catch (EntitlementApiException e) {
Assert.fail("Test failed " + e.getMessage());
} catch (AccountApiException e) {
Assert.fail("Test failed " + e.getMessage());
}
}
}