unit testing - gwt-test-utils: JSO Patcher not working? -


i have jsni code unit test, decided use gwt-test-utils' patcher reason it's not working...

i have followed , double checked code , can't work.. have feeling it's silly i'm forgetting, can spot problem?

test:

@gwtmodule("com.my.app.gwt.client.view.myview") public class myviewtest extends gwttest {  private myview mview;  @before public void setup() {     mview = new myview(mockito.mock(myview.binder.class)); }  @test public void shouldgetmyconfigandparse() {     myconfig omyconfig = mview.getmyconfig();     system.out.println("########## omyconfig=" + omyconfig);     asserttrue(true); }  } 

view:

public class myview extends viewimpl implements mypresenter.myview {  interface binder extends uibinder<widget, myview> { }  @uifield simplepanel mmainpanel;  @inject public myview(binder pbinder) {     initwidget(pbinder.createandbindui(this)); }  @override public void setinslot(object pslot, iswidget pcontent) {     if (pslot == mypresenter.slot_main) mmainpanel.setwidget(pcontent);     else super.setinslot(pslot, pcontent); }  @override public myconfig getmyconfig() {     jsomyconfig ojsoconfig = getjsomyconfig();     myconfig oconfig = new myconfig();     oconfig.setautoplay(ojsoconfig.isautoplay());     oconfig.setwidth(ojsoconfig.getwidth());     oconfig.setheight(ojsoconfig.getheight());     return oconfig; }  private native jsomyconfig getjsomyconfig()/*-{     return $wnd.myconfig; }-*/;  } 

jso

public class jsomyconfig extends javascriptobject {  protected jsomyconfig() { }  public native boolean isautoplay() /*-{      return this.autoplay; }-*/;  public native string getwidth() /*-{      return this.width; }-*/;  public native string getheight() /*-{      return this.height; }-*/;  } 

jsopatcher

@patchclass(jsomyconfig.class) public class jsomyconfigpatcher {  @patchmethod public static boolean isautoplay(jsomyconfig jsomyconfig) {     return false; }  @patchmethod public static string getwidth(jsomyconfig jsomyconfig) {     return "500"; }  @patchmethod public static string getheight(jsomyconfig jsomyconfig) {     return "400"; }  } 

meta-inf/gwt-test-utils.properties:

com.my.app.gwt.client.config.model.jso = scan-package com.my.app.gwt.client.view.myview = gwt-module 

did miss anything?

thanks time :)

you patched jsomyconfig jsni methods, apparently not myview.getjsomyconfig() one. right ?


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -