Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Follow the same procedure as described for in the Synapse-Services-Repository project: Developer Best Practices

Read about GWT Development with Activities and Places

Use SafeHtml

Read this document on use of SafeHtml in GWT and adhere strictly to the contracts described. Apply true escaping methods to any user-generated value in the system.  

Testing

See the general Synapse testing philosophy on the Synapse-Services-Repository Developer Best Practices page.

Specifics For GWT Testing

  • Put all business logic into Presenters and make them JRE testable (aka JUnit). 
    • This means that Presenters can not deal with class instances that rely upon GWT.create(...) calls. For the rare case when this is necessary, create a GWTTestCase. Be aware that these tests take significant time to spin up.
    • The philosophy of our architecture and this testing technique is described here
  • To mock callbacks, such as with RPC services, use AsyncMockStubber's static methods. 

    Code Block
    languagejava
    // Example call onSuccess(..)
    AsyncMockStubber.callSuccessWith("Result Object").when(mockService).getSomething(eq("someInputParam"), any(AsyncCallback.class)); 
     
    // Example call onFailure(..)
    AsyncMockStubber.callFailureWith(new Throwable("error message")).when(mockService).getSomething(eq("someInputParam"), any(AsyncCallback.class));