Barry
Barry

Reputation: 1665

GWT PRESENTER MOCKING

Is it a good practice for using GWT.create for instantiating a Asynchronous Interface in the GWT Presenter?

The reason why i am asking is i need to write Junit test cases for the presenter (i dont want to use the GWTTESTCASE) and using mockito to mock and stub things that i require.

But i cannot mock on these Asynchronous interfaces because i am using GWT.create to create them

Please let me know in case more details are required

Thanks

Upvotes: 1

Views: 446

Answers (1)

fgb
fgb

Reputation: 18569

An instance of the asynchronous interface should be passed to the presenter via a constructor or set method, so all the GWT.create calls are outside the Presenter. This allows you to pass in a mock instance within the Junit tests.

Upvotes: 6

Related Questions