Search in sources :

Example 1 with FilterBean

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

the class ReportedHoursIndicatorTest method testGetFilter.

@Test
public void testGetFilter() {
    hoursIndicator = new ReportedHoursIndicator();
    FacesContext facesContext = createMock(FacesContext.class);
    Application application = createMock(Application.class);
    FilterBean filterBean = createMock(FilterBean.class);
    Filter filter = new Filter();
    PowerMock.mockStatic(FacesContext.class);
    expect(FacesContext.getCurrentInstance()).andReturn(facesContext);
    expect(facesContext.getApplication()).andReturn(application);
    expect(application.evaluateExpressionGet(facesContext, "#{filterBean}", Object.class)).andReturn(filterBean);
    expect(filterBean.getCurrentFilter()).andReturn(filter);
    PowerMock.replayAll(FacesContext.class, facesContext, application, filterBean);
    Filter actual = hoursIndicator.getFilter();
    PowerMock.verifyAll();
    assertSame(filter, actual);
}
Also used : FacesContext(javax.faces.context.FacesContext) Filter(com.artezio.arttime.filter.Filter) Application(javax.faces.application.Application) FilterBean(com.artezio.arttime.web.FilterBean) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

Filter (com.artezio.arttime.filter.Filter)1 FilterBean (com.artezio.arttime.web.FilterBean)1 Application (javax.faces.application.Application)1 FacesContext (javax.faces.context.FacesContext)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1