@Before public void setUp() { Display display = new Display(); Shell shell = new Shell(display); text = new Text(shell, SWT.NONE); remoteObject = mock(RemoteObject.class); connection = mock(Connection.class); when(connection.createRemoteObject(anyString())).thenReturn(remoteObject); Fixture.fakeConnection(connection); doAnswer( new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { handler = (OperationHandler) invocation.getArguments()[0]; return null; } }) .when(remoteObject) .setHandler(any(OperationHandler.class)); dropDown = new DropDown(text); }
/** Create a RAP Remote object which will handle the client/server interaction */ protected RemoteObject createRemoteObject(Connection connection) { return connection.createRemoteObject(REMOTE_TYPE); }