Skip to content

Commit 017325e

Browse files
author
j.schmied@pay-co.net
committed
review fixes
1 parent 1c901c6 commit 017325e

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

gwtmockito/src/main/java/com/google/gwtmockito/impl/ReturnsCustomMocks.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
4343
} else if (invocation.getMock() instanceof Element && methodName.equals("getTagName")) {
4444
String className = invocation.getMock().getClass().getSimpleName();
4545
return className.substring(0, className.indexOf("Element")).toLowerCase();
46-
} else if (invocation.getMock() instanceof InputElement && methodName.equals("getType")) {
47-
return "text";
46+
} else if (invocation.getMock() instanceof InputElement && methodName.equals("getType")) {
47+
return "text";
4848
} else {
4949
return super.answer(invocation);
5050
}

gwtmockito/src/main/java/com/google/gwtmockito/impl/StubGenerator.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ public class StubGenerator {
6262
STUB_METHODS.put(
6363
new ClassAndMethod(InputElement.class, "as"),
6464
new ReturnMockStubMethod(InputElement.class));
65-
// URL.encodeQueryStringImpl
66-
STUB_METHODS.put(
67-
new ClassAndMethod(URL.class, "encodeQueryStringImpl"),
68-
new ReturnStringStubMethod("encodeQueryStringImpl"));
69-
// URL.encodePathSegmentImpl
70-
STUB_METHODS.put(
71-
new ClassAndMethod(URL.class, "encodePathSegmentImpl"),
72-
new ReturnStringStubMethod("encodePathSegmentImpl"));
65+
// URL.encodeQueryStringImpl
66+
STUB_METHODS.put(
67+
new ClassAndMethod(URL.class, "encodeQueryStringImpl"),
68+
new ReturnStringStubMethod("encodeQueryStringImpl"));
69+
// URL.encodePathSegmentImpl
70+
STUB_METHODS.put(
71+
new ClassAndMethod(URL.class, "encodePathSegmentImpl"),
72+
new ReturnStringStubMethod("encodePathSegmentImpl"));
7373
}
7474

7575
/** Returns whether the behavior of the given method should be replaced. */
@@ -183,10 +183,10 @@ public Object invoke() {
183183
/** A fake method implementation that just returns a string. */
184184
private static class ReturnStringStubMethod implements StubMethod {
185185

186-
private String str;
186+
private String str;
187187

188-
ReturnStringStubMethod(String str) {
189-
this.str = str;
188+
ReturnStringStubMethod(String str) {
189+
this.str = str;
190190
}
191191

192192
@Override

gwtmockito/src/test/java/com/google/gwtmockito/GwtMockitoTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
import com.google.gwt.dom.client.Document;
3333
import com.google.gwt.dom.client.Element;
3434
import com.google.gwt.dom.client.IFrameElement;
35+
import com.google.gwt.dom.client.InputElement;
3536
import com.google.gwt.dom.client.Node;
37+
import com.google.gwt.http.client.URL;
3638
import com.google.gwt.i18n.client.BidiPolicy;
3739
import com.google.gwt.i18n.client.DateTimeFormat;
3840
import com.google.gwt.i18n.client.Messages;
@@ -591,6 +593,17 @@ public void shouldReturnRealElementTagNames() {
591593
assertEquals("iframe", Document.get().createIFrameElement().getTagName());
592594
}
593595

596+
@Test
597+
public void shouldReturnTextAsType() {
598+
assertEquals("text", InputElement.as(Document.get().createTextInputElement()).getType());
599+
}
600+
601+
@Test
602+
public void shouldReturnDummyStringsFromURL() {
603+
assertEquals("encodeQueryStringImpl", URL.encodeQueryString(""));
604+
assertEquals("encodePathSegmentImpl", URL.encodePathSegment(""));
605+
}
606+
594607
@Test
595608
public void shouldBeAbleToInstantiateCellLists() {
596609
assertNotNull(new CellList<String>(new AbstractCell<String>() {

0 commit comments

Comments
 (0)