PartnerServiceBeanTest.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:oscm 作者:
@Before
public void setup() throws Exception {
    query = mock(Query.class);
    service = spy(new PartnerServiceBean());
    service.localizer = mock(LocalizerServiceLocal.class);
    sps = mock(ServiceProvisioningServiceBean.class);
    service.sps = sps;
    service.spsLocal = mock(ServiceProvisioningServiceLocal.class);
    service.ds = mock(DataService.class);
    doReturn(query).when(service.ds).createNamedQuery(
            "Product.getSpecificCustomerProduct");
    service.spsLocalizer = mock(ServiceProvisioningServiceLocalizationLocal.class);
    service.sessionCtx = mock(SessionContext.class);
    service.slService = mock(SubscriptionListServiceLocal.class);
    when(service.ds.getCurrentUser()).thenReturn(new PlatformUser());
    product = new Product();
    product.setStatus(ServiceStatus.INACTIVE);
    doReturn(product).when(service.ds).getReference(eq(Product.class),
            anyLong());

    PlatformUser u = new PlatformUser();
    u.setLocale("locale");
    doReturn(u).when(service.ds).getCurrentUser();
    doReturn(Boolean.FALSE).when(service.slService)
            .isUsableSubscriptionExistForTemplate(any(PlatformUser.class),
                    eq(Subscription.ASSIGNABLE_SUBSCRIPTION_STATUS),
                    any(Product.class));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号