Search in sources :

Example 11 with FederatedServiceCollection

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

the class FederatedByCoordinateBoundsMethodInvocationHandlerImplTest method test02.

@Test
public void test02() throws Exception {
    CoordinateBounds bounds = new CoordinateBounds(0, 1, 2, 3);
    CoordinateBoundsTestBean bean = new CoordinateBoundsTestBean();
    bean.setBounds(bounds);
    SimpleFederatedService mockService = Mockito.mock(SimpleFederatedService.class);
    FederatedServiceCollection mockCollection = Mockito.mock(FederatedServiceCollectionImpl.class);
    Mockito.when(mockCollection.getServiceForBounds(bounds)).thenReturn(mockService);
    Method method = SimpleFederatedService.class.getDeclaredMethod("getValueForCoordinateBoundsTestBean", CoordinateBoundsTestBean.class);
    Object[] args = { bean };
    FederatedServiceMethodInvocationHandler handler = new FederatedByCoordinateBoundsMethodInvocationHandlerImpl(method, 0, "bounds");
    handler.invoke(mockCollection, method, args);
    Mockito.verify(mockService).getValueForCoordinateBoundsTestBean(bean);
}
Also used : CoordinateBoundsTestBean(org.onebusaway.federations.CoordinateBoundsTestBean) FederatedServiceCollection(org.onebusaway.federations.FederatedServiceCollection) Method(java.lang.reflect.Method) SimpleFederatedService(org.onebusaway.federations.SimpleFederatedService) CoordinateBounds(org.onebusaway.geospatial.model.CoordinateBounds) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)11 Test (org.junit.Test)11 FederatedServiceCollection (org.onebusaway.federations.FederatedServiceCollection)11 SimpleFederatedService (org.onebusaway.federations.SimpleFederatedService)11 HashSet (java.util.HashSet)4 FederatedService (org.onebusaway.federations.FederatedService)2 CoordinateBounds (org.onebusaway.geospatial.model.CoordinateBounds)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 CoordinateBoundsTestBean (org.onebusaway.federations.CoordinateBoundsTestBean)1 EntityIdTestBean (org.onebusaway.federations.EntityIdTestBean)1