Search in sources :

Example 1 with EntityIdTestBean

use of org.onebusaway.federations.EntityIdTestBean in project onebusaway-application-modules by camsys.

the class FederatedByAgencyIdMethodInvocationHandlerImplTest method testPropertyExpression.

@Test
public void testPropertyExpression() throws Exception {
    SimpleFederatedService mockService = Mockito.mock(SimpleFederatedService.class);
    FederatedServiceCollection mockCollection = Mockito.mock(FederatedServiceCollectionImpl.class);
    Mockito.when(mockCollection.getServiceForAgencyId("agency")).thenReturn(mockService);
    Method method = SimpleFederatedService.class.getDeclaredMethod("getValueForValueBean", EntityIdTestBean.class);
    EntityIdTestBean value = new EntityIdTestBean("agency_entity");
    Object[] args = { value };
    FederatedServiceMethodInvocationHandler handler = new FederatedByEntityIdMethodInvocationHandlerImpl(method, 0, "id");
    handler.invoke(mockCollection, method, args);
    Mockito.verify(mockService).getValueForValueBean(value);
}
Also used : EntityIdTestBean(org.onebusaway.federations.EntityIdTestBean) FederatedServiceCollection(org.onebusaway.federations.FederatedServiceCollection) Method(java.lang.reflect.Method) SimpleFederatedService(org.onebusaway.federations.SimpleFederatedService) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)1 Test (org.junit.Test)1 EntityIdTestBean (org.onebusaway.federations.EntityIdTestBean)1 FederatedServiceCollection (org.onebusaway.federations.FederatedServiceCollection)1 SimpleFederatedService (org.onebusaway.federations.SimpleFederatedService)1