Commit 8c9280c6 authored by Matija Obreza's avatar Matija Obreza

Tests: Less verbose tests

parent 5c94f58d
......@@ -168,7 +168,7 @@ public class InventoryControllerTest extends AbstractApiV1Test {
.contentType(MediaType.APPLICATION_JSON)
.content(verboseMapper.writeValueAsString(quantity))
)
.andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
// .andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
.andExpect(status().isOk())
;
/*@formatter:on*/
......@@ -226,7 +226,7 @@ public class InventoryControllerTest extends AbstractApiV1Test {
.contentType(MediaType.APPLICATION_JSON)
.content(verboseMapper.writeValueAsString(quantity))
)
.andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
// .andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
.andExpect(status().isOk())
;
/*@formatter:on*/
......
......@@ -15,22 +15,13 @@
*/
package org.gringlobal.test.api.v1;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import com.google.common.collect.Sets;
import org.genesys.blocks.oauth.model.OAuthClient;
import org.genesys.blocks.oauth.persistence.OAuthClientRepository;
import org.genesys.blocks.oauth.service.OAuthClientDetailsService;
......@@ -43,9 +34,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.test.context.support.WithUserDetails;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.collect.Sets;
/**
* @author Maxym Borodenko
*/
......@@ -87,8 +79,7 @@ public class OAuthManagementControllerTest extends AbstractApiV1Test {
.perform(post(OAuthManagementController.API_URL + "/filter")
.contentType(MediaType.APPLICATION_JSON)
.content(verboseMapper.writeValueAsString(filter)))
.andDo(MockMvcResultHandlers.print())
.andDo(MockMvcResultHandlers.print())
// .andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$.content", hasSize(1)))
......@@ -108,7 +99,7 @@ public class OAuthManagementControllerTest extends AbstractApiV1Test {
.perform(post(OAuthManagementController.API_URL)
.contentType(MediaType.APPLICATION_JSON)
.content(verboseMapper.writeValueAsString(client)))
// .andDo(MockMvcResultHandlers.print())
// .andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", notNullValue()))
......@@ -141,7 +132,7 @@ public class OAuthManagementControllerTest extends AbstractApiV1Test {
.perform(put(OAuthManagementController.API_URL)
.contentType(MediaType.APPLICATION_JSON)
.content(verboseMapper.writeValueAsString(client)))
// .andDo(MockMvcResultHandlers.print())
// .andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", notNullValue()))
......@@ -167,7 +158,7 @@ public class OAuthManagementControllerTest extends AbstractApiV1Test {
mockMvc
.perform(delete(OAuthManagementController.API_URL + OAuthManagementController.ENDPOINT_CLIENT_ID, client.getClientId())
.contentType(MediaType.APPLICATION_JSON))
// .andDo(MockMvcResultHandlers.print())
// .andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
;
......@@ -185,7 +176,7 @@ public class OAuthManagementControllerTest extends AbstractApiV1Test {
mockMvc
.perform(post(OAuthManagementController.API_URL + "/{clientId}/secret", client.getClientId())
.contentType(MediaType.APPLICATION_JSON))
// .andDo(MockMvcResultHandlers.print())
// .andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(jsonPath("$").exists())
.andExpect(jsonPath("$").isString())
......@@ -203,7 +194,7 @@ public class OAuthManagementControllerTest extends AbstractApiV1Test {
mockMvc
.perform(delete(OAuthManagementController.API_URL + "/{clientId}/secret", client.getClientId())
.contentType(MediaType.APPLICATION_JSON))
// .andDo(MockMvcResultHandlers.print())
// .andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(jsonPath("$", notNullValue()))
.andExpect(jsonPath("$.clientSecret", nullValue()))
......@@ -222,7 +213,7 @@ public class OAuthManagementControllerTest extends AbstractApiV1Test {
mockMvc
.perform(get(OAuthManagementController.API_URL + OAuthManagementController.ENDPOINT_CLIENT_ID, client.getClientId())
.contentType(MediaType.APPLICATION_JSON))
// .andDo(MockMvcResultHandlers.print())
// .andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$", notNullValue()))
......@@ -243,7 +234,7 @@ public class OAuthManagementControllerTest extends AbstractApiV1Test {
mockMvc
.perform(get(OAuthManagementController.API_URL + OAuthManagementController.ENDPOINT_CLIENT_ID, "notExistingClientId")
.contentType(MediaType.APPLICATION_JSON))
// .andDo(MockMvcResultHandlers.print())
// .andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
.andExpect(status().isNotFound())
;
/*@formatter:on*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment