Search in sources :

Example 1 with ProjectsBean

use of com.artezio.arttime.web.ProjectsBean in project ART-TIME by Artezio.

the class CDIUtilsTest method testGetBean.

@Test
public void testGetBean() {
    CDI cdi = createMock(CDI.class);
    Instance instance = createMock(Instance.class);
    ProjectsBean projectsBean = createMock(ProjectsBean.class);
    PowerMock.mockStatic(CDI.class);
    expect(CDI.current()).andReturn(cdi);
    expect(cdi.select(ProjectsBean.class)).andReturn(instance);
    expect(instance.get()).andReturn(projectsBean);
    PowerMock.replayAll(CDI.class, cdi, instance);
    ProjectsBean actual = CDIUtils.getBean(ProjectsBean.class);
    PowerMock.verifyAll();
}
Also used : Instance(javax.enterprise.inject.Instance) ProjectsBean(com.artezio.arttime.web.ProjectsBean) CDI(javax.enterprise.inject.spi.CDI) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

ProjectsBean (com.artezio.arttime.web.ProjectsBean)1 Instance (javax.enterprise.inject.Instance)1 CDI (javax.enterprise.inject.spi.CDI)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1