Refactorings
This commit is contained in:
@ -22,6 +22,7 @@ import jpushover.MockServer;
|
||||
*
|
||||
*/
|
||||
public class GlanceTest {
|
||||
private static final String URL = "http://127.0.0.1:8080/1/glances.json";
|
||||
private static final String APPLICATION_JSON = "application/json; charset=utf-8";
|
||||
private static final String CONTENT_TYPE = "Content-Type";
|
||||
|
||||
@ -31,7 +32,7 @@ public class GlanceTest {
|
||||
|
||||
@Test()
|
||||
public void testTokenRequired() throws IOException, InterruptedException {
|
||||
stubFor(post(urlEqualTo("/1/glances.json"))
|
||||
stubFor(post(urlEqualTo(URL))
|
||||
.willReturn(aResponse()
|
||||
.withStatus(400)
|
||||
.withHeader(CONTENT_TYPE, APPLICATION_JSON)));
|
||||
@ -43,7 +44,7 @@ public class GlanceTest {
|
||||
|
||||
@Test()
|
||||
public void testUserRequired() throws IOException, InterruptedException {
|
||||
stubFor(post(urlEqualTo("/1/glances.json"))
|
||||
stubFor(post(urlEqualTo(URL))
|
||||
.willReturn(aResponse()
|
||||
.withStatus(400)
|
||||
.withHeader(CONTENT_TYPE, APPLICATION_JSON)));
|
||||
@ -55,7 +56,7 @@ public class GlanceTest {
|
||||
|
||||
@Test()
|
||||
public void testPushWithoutContent() throws IOException, InterruptedException {
|
||||
stubFor(post(urlEqualTo("/1/glances.json"))
|
||||
stubFor(post(urlEqualTo(URL))
|
||||
.willReturn(aResponse()
|
||||
.withStatus(400)
|
||||
.withHeader(CONTENT_TYPE, APPLICATION_JSON)));
|
||||
@ -66,7 +67,7 @@ public class GlanceTest {
|
||||
|
||||
@Test
|
||||
public void testPush() throws IOException, InterruptedException {
|
||||
stubFor(post(urlEqualTo("/1/glances.json"))
|
||||
stubFor(post(urlEqualTo(URL))
|
||||
.willReturn(aResponse()
|
||||
.withStatus(200)
|
||||
.withHeader(CONTENT_TYPE, APPLICATION_JSON)));
|
||||
|
@ -27,6 +27,7 @@ import jpushover.MockServer;
|
||||
*
|
||||
*/
|
||||
public class MessageTest {
|
||||
private static final String URL = "https://api.pushover.net/1/messages.json";
|
||||
private static final String APPLICATION_JSON = "application/json; charset=utf-8";
|
||||
private static final String CONTENT_TYPE = "Content-Type";
|
||||
|
||||
@ -36,7 +37,7 @@ public class MessageTest {
|
||||
|
||||
@Test()
|
||||
public void testTokenRequired() throws IOException, InterruptedException {
|
||||
stubFor(post(urlEqualTo("/1/messages.json"))
|
||||
stubFor(post(urlEqualTo(URL))
|
||||
.willReturn(aResponse()
|
||||
.withStatus(400)
|
||||
.withHeader(CONTENT_TYPE, APPLICATION_JSON)));
|
||||
@ -48,7 +49,7 @@ public class MessageTest {
|
||||
|
||||
@Test()
|
||||
public void testUserRequired() throws IOException, InterruptedException {
|
||||
stubFor(post(urlEqualTo("/1/messages.json"))
|
||||
stubFor(post(urlEqualTo(URL))
|
||||
.willReturn(aResponse()
|
||||
.withStatus(400)
|
||||
.withHeader(CONTENT_TYPE, APPLICATION_JSON)));
|
||||
@ -60,7 +61,7 @@ public class MessageTest {
|
||||
|
||||
@Test()
|
||||
public void testMessageRequired() throws IOException, InterruptedException {
|
||||
stubFor(post(urlEqualTo("/1/messages.json"))
|
||||
stubFor(post(urlEqualTo(URL))
|
||||
.willReturn(aResponse()
|
||||
.withStatus(400)
|
||||
.withHeader(CONTENT_TYPE, APPLICATION_JSON)));
|
||||
@ -72,7 +73,7 @@ public class MessageTest {
|
||||
|
||||
@Test()
|
||||
public void testPushWithoutContent() throws IOException, InterruptedException {
|
||||
stubFor(post(urlEqualTo("/1/messages.json"))
|
||||
stubFor(post(urlEqualTo(URL))
|
||||
.willReturn(aResponse()
|
||||
.withStatus(400)
|
||||
.withHeader(CONTENT_TYPE, APPLICATION_JSON)));
|
||||
@ -83,7 +84,7 @@ public class MessageTest {
|
||||
|
||||
@Test
|
||||
public void testPush() throws IOException, InterruptedException {
|
||||
stubFor(post(urlEqualTo("/1/messages.json"))
|
||||
stubFor(post(urlEqualTo(URL))
|
||||
.willReturn(aResponse()
|
||||
.withStatus(200)
|
||||
.withHeader(CONTENT_TYPE, APPLICATION_JSON)));
|
||||
|
Reference in New Issue
Block a user