Search in sources :

Example 6 with ContainerState

use of com.qcadoo.view.internal.api.ContainerState in project qcadoo by qcadoo.

the class ViewDefinitionStateTest method shouldPerformEventOnState.

@Test
public void shouldPerformEventOnState() throws Exception {
    // given
    ViewDefinitionStateImpl viewDefinitionState = new ViewDefinitionStateImpl();
    ContainerState state1 = mock(ContainerState.class);
    given(state1.getName()).willReturn("name1");
    InternalComponentState state2 = mock(InternalComponentState.class);
    viewDefinitionState.addChild(state1);
    given(state1.getChild("name2")).willReturn(state2);
    // when
    viewDefinitionState.performEvent("name1.name2", "event", new String[] { "arg1", "arg2" });
    // then
    Mockito.verify(state2).performEvent(viewDefinitionState, "event", "arg1", "arg2");
}
Also used : ViewDefinitionStateImpl(com.qcadoo.view.internal.internal.ViewDefinitionStateImpl) ContainerState(com.qcadoo.view.internal.api.ContainerState) InternalComponentState(com.qcadoo.view.internal.api.InternalComponentState) Test(org.junit.Test) AbstractStateTest(com.qcadoo.view.internal.states.AbstractStateTest)

Aggregations

ContainerState (com.qcadoo.view.internal.api.ContainerState)6 InternalComponentState (com.qcadoo.view.internal.api.InternalComponentState)6 ViewDefinitionStateImpl (com.qcadoo.view.internal.internal.ViewDefinitionStateImpl)3 AbstractStateTest (com.qcadoo.view.internal.states.AbstractStateTest)3 Test (org.junit.Test)3 ComponentState (com.qcadoo.view.api.ComponentState)2 AbstractContainerState (com.qcadoo.view.internal.states.AbstractContainerState)2 InternalViewDefinitionState (com.qcadoo.view.internal.api.InternalViewDefinitionState)1