Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

135-テスト記述 #148

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ public class SignInTest {
public WireMockRule wireMockRule = new WireMockRule(8080);

@Test
public void post() throws Exception {
public void post_null() throws Exception {
stubFor(WireMock.post(urlPathEqualTo("/login"))
.withHeader("Content-Type", matching("application/json"))
.willReturn(aResponse()));
SignIn signIn = new SignIn();
signIn.post("", "");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

post_nullとかにしないでpostのままで,そのレスポンスがあってるかどうか?をverifyするとよい.

[参考]
http://wiremock.org/docs/verifying/

}

}
Expand Down
4 changes: 3 additions & 1 deletion app/src/test/resources/mappings/login.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
},
"response": {
"status": 200,
"body": "{\"result\":\"success\"}",
"jsonBody": {
"result":"success"
}
}
}