use of org.onebusaway.federations.SimpleFederatedService in project onebusaway-application-modules by camsys.
the class FederatedByBoundsMethodInvocationHandlerImplTest method testSimple.
@Test
public void testSimple() throws Exception {
SimpleFederatedService mockService = Mockito.mock(SimpleFederatedService.class);
FederatedServiceCollection mockCollection = Mockito.mock(FederatedServiceCollectionImpl.class);
Mockito.when(mockCollection.getServiceForBounds(0.0, 1.0, 2.0, 3.0)).thenReturn(mockService);
Method method = SimpleFederatedService.class.getDeclaredMethod("getValueForBounds", Double.TYPE, Double.TYPE, Double.TYPE, Double.TYPE);
Object[] args = { 0.0, 1.0, 2.0, 3.0 };
FederatedServiceMethodInvocationHandler handler = new FederatedByBoundsMethodInvocationHandlerImpl(0, 1, 2, 3);
handler.invoke(mockCollection, method, args);
Mockito.verify(mockService).getValueForBounds(0.0, 1.0, 2.0, 3.0);
}
use of org.onebusaway.federations.SimpleFederatedService 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);
}
Aggregations