This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private SampleWidget sampleWidget; // do not initialize here, but at the end of the setUp() method... | |
private SimpleEventBus = new SimpleEventBus(); | |
@Before | |
public void setUp() { | |
GwtMockito.useProviderForType(SimpleEventBus.class, new FakeProvider() { | |
@Override | |
public Object getFake(Class aClass) { | |
return simpleEventBus; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleWidget implements IsWidget { | |
private EventBus bus = GWT.create(SimpleEventBus.class); | |
private VerticalPanel panel = GWT.create(VerticalPanel.class); | |
public SampleWidget() { | |
final Button button = GWT.create(Button.class); | |
button.setText("Click me"); | |
final Label label = GWT.create(Label.class); | |
button.addClickHandler(new ClickHandler() { | |
public void onClick(ClickEvent event) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.objectpartners.buesing.test; | |
public class EasyToMock { | |
public String method() { | |
return "EasyToMockValue"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.objectpartners.buesing.test; | |
public final class HardToMock { | |
public final String finalMethod() { | |
return "HardToMock value"; | |
} | |
public final native String nativeMethod(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.objectpartners.buesing.test; | |
import junit.framework.Assert; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.mockito.Mock; | |
import org.mockito.Mockito; | |
import com.objectpartners.buesing.premock.PreMock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.objectpartners.buesing.premock; | |
import java.lang.reflect.Field; | |
import java.lang.reflect.Method; | |
import java.util.HashSet; | |
import java.util.Set; | |
import org.junit.runners.BlockJUnit4ClassRunner; | |
import org.junit.runners.ParentRunner; | |
import org.junit.runners.model.FrameworkMethod; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.objectpartners.buesing.premock; | |
import java.io.IOException; | |
import java.lang.reflect.Modifier; | |
import java.util.Collections; | |
import java.util.HashSet; | |
import java.util.Set; | |
import javassist.CannotCompileException; | |
import javassist.ClassPool; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.objectpartners.buesing.premock; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
@Retention(RetentionPolicy.RUNTIME) | |
public @interface PreMock { | |
Class<?>[] value(); | |
} |
NewerOlder