-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
313 additions
and
20 deletions.
There are no files selected for viewing
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
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
36 changes: 36 additions & 0 deletions
36
.../src/test/java/com/github/restup/http/model/HttpServletResourceControllerRequestTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.github.restup.http.model; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.MockitoJUnitRunner; | ||
import com.github.restup.errors.ErrorObjectException; | ||
import com.github.restup.registry.ResourceRegistry; | ||
import static org.mockito.Mockito.*; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class HttpServletResourceControllerRequestTest { | ||
|
||
@Mock | ||
HttpServletRequest httpRequest; | ||
|
||
ResourceRegistry registry = new ResourceRegistry(); | ||
|
||
|
||
@Test(expected=ErrorObjectException.class) | ||
public void testResponse() { | ||
when(httpRequest.getRequestURL()).thenReturn(new StringBuffer("http://www.foo.com/a/b/c")); | ||
when(httpRequest.getRequestURI()).thenReturn("/a/b/c"); | ||
|
||
HttpServletResourceControllerRequest request = HttpServletResourceControllerRequest.builder(httpRequest).setRegistry(registry).build(); | ||
request.getParameterNames(); | ||
request.getParameter("foo"); | ||
request.getHeaders("bar"); | ||
verify(httpRequest).getParameterNames(); | ||
verify(httpRequest).getParameter("foo"); | ||
verify(httpRequest).getHeaders("bar"); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...src/test/java/com/github/restup/http/model/HttpServletResourceControllerResponseTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.github.restup.http.model; | ||
|
||
import javax.servlet.http.HttpServletResponse; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.MockitoJUnitRunner; | ||
import static org.mockito.Mockito.verify; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class HttpServletResourceControllerResponseTest { | ||
|
||
@Mock | ||
HttpServletResponse httpServletResponse; | ||
|
||
@Test | ||
public void testResponse() { | ||
HttpServletResourceControllerResponse response = new HttpServletResourceControllerResponse(httpServletResponse); | ||
String name = "foo"; | ||
String value = "bar"; | ||
int status = 123; | ||
response.setHeader(name, value); | ||
response.setStatus(status); | ||
|
||
verify(httpServletResponse).setHeader(name, value); | ||
verify(httpServletResponse).setStatus(status); | ||
} | ||
} |
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.test.model; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
import org.junit.Test; | ||
import com.deep.Shallow; | ||
import com.many.fields.A2J; | ||
|
||
public class DeepTest { | ||
|
||
@Test | ||
public void deep() { | ||
Shallow graph = Shallow.graph(); | ||
assertNotNull(graph); | ||
} | ||
|
||
@Test | ||
public void a2j() { | ||
new A2J(1l,"a","b","c","d","e","f","g","h","i","j"); | ||
} | ||
|
||
} |
Oops, something went wrong.