Package org.eclipse.rap.json

Examples of org.eclipse.rap.json.JsonObject


  public void testDelegatesPositionErrorWhenGetPosition() {
    GeolocationListener listener = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener );
    geolocation.determineCurrentPosition( new GeolocationOptions() );
    JsonObject properties = new JsonObject();
    properties.add( "errorCode", "UNKNOWN" );
    properties.add( "errorMessage", "A Message" );

    environment.dispatchNotifyOnServiceObject( "LocationUpdateError", properties );

    ArgumentCaptor<PositionError> captor = ArgumentCaptor.forClass( PositionError.class );
    verify( listener ).errorReceived( captor.capture() );
View Full Code Here


  public void testDelegatesPositionErrorWhenWatch() {
    GeolocationListener listener = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener );
    geolocation.watchPosition( new GeolocationOptions() );
    JsonObject properties = new JsonObject();
    properties.add( "errorCode", "UNKNOWN" );
    properties.add( "errorMessage", "A Message" );

    environment.dispatchNotifyOnServiceObject( "LocationUpdateError", properties );

    ArgumentCaptor<PositionError> captor = ArgumentCaptor.forClass( PositionError.class );
    verify( listener ).errorReceived( captor.capture() );
View Full Code Here

  public void testCallsExecuteOnSelectionEvent() {
    SearchAction action = spy( new TestSearchAction() );
    when( actionDescriptor.getAction() ).thenReturn( action );
    new RemoteSearchAction( ui, uiRenderer, actionDescriptor );

    environment.dispatchNotify( "Selection", new JsonObject() );

    verify( action ).execute( ui );
  }
View Full Code Here

  @Test
  public void testCallsSearchOnSearchEvent() {
    SearchAction action = spy( new TestSearchAction() );
    when( actionDescriptor.getAction() ).thenReturn( action );
    new RemoteSearchAction( ui, uiRenderer, actionDescriptor );
    JsonObject properties = new JsonObject();
    properties.add( "query", "bar" );

    environment.dispatchNotify( "Search", properties );

    verify( action ).search( "bar" );
  }
View Full Code Here

    SearchActionListener listener = mock( SearchActionListener.class );
    mockUI( listener );
    SearchAction action = spy( new TestSearchAction() );
    when( actionDescriptor.getAction() ).thenReturn( action );
    new RemoteSearchAction( ui, uiRenderer, actionDescriptor );
    JsonObject properties = new JsonObject();
    properties.add( "query", "bar" );

    environment.dispatchNotify( "Search", properties );

    verify( listener ).searched( ui, action, "bar" );
  }
View Full Code Here

  @Test
  public void testCallsGetProposalsOnModifyEvent() {
    SearchAction action = spy( new TestSearchAction() );
    when( actionDescriptor.getAction() ).thenReturn( action );
    new RemoteSearchAction( ui, uiRenderer, actionDescriptor );
    JsonObject properties = new JsonObject();
    properties.add( "query", "bar" );

    environment.dispatchNotify( "Modify", properties );

    verify( action ).modified( eq( "bar" ), any( ProposalHandler.class ) );
  }
View Full Code Here

    SearchActionListener listener = mock( SearchActionListener.class );
    mockUI( listener );
    SearchAction action = spy( new TestSearchAction() );
    when( actionDescriptor.getAction() ).thenReturn( action );
    new RemoteSearchAction( ui, uiRenderer, actionDescriptor );
    JsonObject properties = new JsonObject();
    properties.add( "query", "bar" );

    environment.dispatchNotify( "Modify", properties );

    verify( listener ).modified( ui, action, "bar" );
  }
View Full Code Here

    when( actionDescriptor.getAction() ).thenReturn( action );
    new RemoteSearchAction( ui, uiRenderer, actionDescriptor );
    List<Proposal> proposals = new ArrayList<Proposal>();
    proposals.add( new Proposal( "foo" ) );
    proposals.add( new Proposal( "bar" ) );
    JsonObject properties = new JsonObject();
    properties.add( "query", "bar" );
    environment.dispatchNotify( "Modify", properties );
    ArgumentCaptor<ProposalHandler> captor = ArgumentCaptor.forClass( ProposalHandler.class );
    verify( action ).modified( eq( "bar" ), captor.capture() );

    captor.getValue().setProposals( proposals );
View Full Code Here

  @Test
  public void testSendsNullProposalsAsEmptyArray() {
    SearchAction action = spy( new TestSearchAction() );
    when( actionDescriptor.getAction() ).thenReturn( action );
    new RemoteSearchAction( ui, uiRenderer, actionDescriptor );
    JsonObject properties = new JsonObject();
    properties.add( "query", "bar" );
    environment.dispatchNotify( "Modify", properties );
    ArgumentCaptor<ProposalHandler> captor = ArgumentCaptor.forClass( ProposalHandler.class );
    verify( action ).modified( eq( "bar" ), captor.capture() );

    captor.getValue().setProposals( new ArrayList<Proposal>() );
View Full Code Here

  public void testFailsWithNullProposals() {
    SearchAction action = spy( new TestSearchAction() );
    when( actionDescriptor.getAction() ).thenReturn( action );
    new RemoteSearchAction( ui, uiRenderer, actionDescriptor );
    when( actionDescriptor.getAction() ).thenReturn( action );
    JsonObject properties = new JsonObject();
    properties.add( "query", "bar" );
    environment.dispatchNotify( "Modify", properties );
    ArgumentCaptor<ProposalHandler> captor = ArgumentCaptor.forClass( ProposalHandler.class );
    verify( action ).modified( eq( "bar" ), captor.capture() );

    captor.getValue().setProposals( null );
View Full Code Here

TOP

Related Classes of org.eclipse.rap.json.JsonObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.