-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
6 changed files
with
153 additions
and
4 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
web/src/test/java/com/navercorp/pinpoint/web/response/AlarmResponseTest.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,26 @@ | ||
package com.navercorp.pinpoint.web.response; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.node.TextNode; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class AlarmResponseTest { | ||
private final ObjectMapper mapper = new ObjectMapper(); | ||
|
||
@Test | ||
public void testCreatedMessage() throws JsonProcessingException { | ||
AlarmResponse result = new AlarmResponse("SUCCESS", "12345"); | ||
checkOutput(result); | ||
} | ||
|
||
private void checkOutput(AlarmResponse codeResult) throws JsonProcessingException { | ||
String jsonString = mapper.writeValueAsString(codeResult); | ||
JsonNode jsonNode = mapper.readTree(jsonString); | ||
Assertions.assertEquals(TextNode.valueOf("SUCCESS"), jsonNode.get("result")); | ||
Assertions.assertNull(jsonNode.get("message")); | ||
Assertions.assertEquals(TextNode.valueOf("12345"), jsonNode.get("ruleId")); | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
web/src/test/java/com/navercorp/pinpoint/web/response/CreateUserGroupResponseTest.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,26 @@ | ||
package com.navercorp.pinpoint.web.response; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.node.TextNode; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class CreateUserGroupResponseTest { | ||
private final ObjectMapper mapper = new ObjectMapper(); | ||
|
||
@Test | ||
public void testCreatedMessage() throws JsonProcessingException { | ||
CreateUserGroupResponse result = new CreateUserGroupResponse("SUCCESS", "12345"); | ||
checkOutput(result); | ||
} | ||
|
||
private void checkOutput(CreateUserGroupResponse codeResult) throws JsonProcessingException { | ||
String jsonString = mapper.writeValueAsString(codeResult); | ||
JsonNode jsonNode = mapper.readTree(jsonString); | ||
Assertions.assertEquals(TextNode.valueOf("SUCCESS"), jsonNode.get("result")); | ||
Assertions.assertNull(jsonNode.get("message")); | ||
Assertions.assertEquals(TextNode.valueOf("12345"), jsonNode.get("number")); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
web/src/test/java/com/navercorp/pinpoint/web/response/SuccessResponseTest.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,34 @@ | ||
package com.navercorp.pinpoint.web.response; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.node.TextNode; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class SuccessResponseTest { | ||
private final ObjectMapper mapper = new ObjectMapper(); | ||
|
||
@Test | ||
public void testStaticOk() throws JsonProcessingException { | ||
Response result = SuccessResponse.ok();; | ||
JsonNode jsonNode = checkOutput(result); | ||
Assertions.assertEquals(TextNode.valueOf("SUCCESS"), jsonNode.get("result")); | ||
Assertions.assertNull(jsonNode.get("message")); | ||
} | ||
|
||
@Test | ||
public void testStaticOkWithMessage() throws JsonProcessingException { | ||
Response result = SuccessResponse.ok("Test Message");; | ||
checkOutput(result); | ||
JsonNode jsonNode = checkOutput(result); | ||
Assertions.assertEquals(TextNode.valueOf("SUCCESS"), jsonNode.get("result")); | ||
Assertions.assertEquals(TextNode.valueOf("Test Message"), jsonNode.get("message")); | ||
} | ||
|
||
private JsonNode checkOutput(Response codeResult) throws JsonProcessingException { | ||
String jsonString = mapper.writeValueAsString(codeResult); | ||
return mapper.readTree(jsonString); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
web/src/test/java/com/navercorp/pinpoint/web/response/WebhookResponseTest.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.navercorp.pinpoint.web.response; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.node.TextNode; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class WebhookResponseTest { | ||
private final ObjectMapper mapper = new ObjectMapper(); | ||
|
||
@Test | ||
public void testCreatedMessage() throws JsonProcessingException { | ||
WebhookResponse result = new WebhookResponse("SUCCESS", "12345"); | ||
checkOutput(result); | ||
} | ||
|
||
private void checkOutput(WebhookResponse codeResult) throws JsonProcessingException { | ||
String jsonString = mapper.writeValueAsString(codeResult); | ||
JsonNode jsonNode = mapper.readTree(jsonString); | ||
Assertions.assertEquals(TextNode.valueOf("SUCCESS"), jsonNode.get("result")); | ||
Assertions.assertNull(jsonNode.get("message")); | ||
Assertions.assertEquals(TextNode.valueOf("12345"), jsonNode.get("webhookId")); | ||
} | ||
|
||
|
||
} |
28 changes: 28 additions & 0 deletions
28
web/src/test/java/com/navercorp/pinpoint/web/response/WebhookSendInfoResponseTest.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.navercorp.pinpoint.web.response; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.node.TextNode; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class WebhookSendInfoResponseTest { | ||
private final ObjectMapper mapper = new ObjectMapper(); | ||
|
||
@Test | ||
public void testCreatedMessage() throws JsonProcessingException { | ||
WebhookSendInfoResponse result = new WebhookSendInfoResponse("SUCCESS", "12345"); | ||
checkOutput(result); | ||
} | ||
|
||
private void checkOutput(WebhookSendInfoResponse codeResult) throws JsonProcessingException { | ||
String jsonString = mapper.writeValueAsString(codeResult); | ||
JsonNode jsonNode = mapper.readTree(jsonString); | ||
Assertions.assertEquals(TextNode.valueOf("SUCCESS"), jsonNode.get("result")); | ||
Assertions.assertNull(jsonNode.get("message")); | ||
Assertions.assertEquals(TextNode.valueOf("12345"), jsonNode.get("webhookSendInfoId")); | ||
} | ||
|
||
|
||
} |