List of usage examples for org.springframework.http MediaType ALL
MediaType ALL
To view the source code for org.springframework.http MediaType ALL.
Click Source Link
From source file:org.craftercms.studio.controller.services.rest.DependencyControllerTest.java
@Test public void testRemoveMissingOperation() throws Exception { doAnswer(new Answer<Void>() { @Override/*from ww w . j av a 2 s . c om*/ public Void answer(InvocationOnMock invocationOnMock) throws Throwable { Object[] args = invocationOnMock.getArguments(); return null; } }).when(this.dependencyManagerMock).remove(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); String itemsJSONList = generateRequestBody(generateItemListMock()); this.mockMvc.perform(post("/api/1/dependency/remove/sample").accept(MediaType.ALL).param("itemId", "1") .content(itemsJSONList.getBytes())).andExpect(status().isBadRequest()); verify(this.dependencyManagerMock, times(0)).remove(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); }
From source file:org.craftercms.studio.controller.services.rest.DependencyControllerTest.java
@Test public void testRemoveMissingDependencies() throws Exception { doAnswer(new Answer<Void>() { @Override//from w w w .j a v a2 s .co m public Void answer(InvocationOnMock invocationOnMock) throws Throwable { Object[] args = invocationOnMock.getArguments(); return null; } }).when(this.dependencyManagerMock).remove(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); this.mockMvc.perform(post("/api/1/dependency/remove/sample").accept(MediaType.ALL).param("itemId", "1") .param("operation", RandomStringUtils.randomAlphabetic(10)).content(StringUtils.EMPTY.getBytes())) .andExpect(status().isBadRequest()); verify(this.dependencyManagerMock, times(0)).remove(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); }
From source file:org.craftercms.studio.controller.services.rest.DependencyControllerTest.java
@Test public void testUpdate() throws Exception { doAnswer(new Answer<Void>() { @Override/*from w w w .ja v a 2 s. com*/ public Void answer(InvocationOnMock invocationOnMock) throws Throwable { Object[] args = invocationOnMock.getArguments(); return null; } }).when(this.dependencyManagerMock).update(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); String itemsJSONList = generateRequestBody(generateItemListMock()); this.mockMvc.perform(post("/api/1/dependency/update/sample").accept(MediaType.ALL).param("itemId", "1") .param("operation", RandomStringUtils.randomAlphabetic(10)).content(itemsJSONList.getBytes())) .andExpect(status().isOk()); verify(this.dependencyManagerMock, times(1)).update(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); }
From source file:org.craftercms.studio.controller.services.rest.DependencyControllerTest.java
@Test public void testUpdateMissingItemId() throws Exception { doAnswer(new Answer<Void>() { @Override/* w ww . j a va 2 s . c om*/ public Void answer(InvocationOnMock invocationOnMock) throws Throwable { Object[] args = invocationOnMock.getArguments(); return null; } }).when(this.dependencyManagerMock).update(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); String itemsJSONList = generateRequestBody(generateItemListMock()); this.mockMvc.perform(post("/api/1/dependency/update/sample").accept(MediaType.ALL) .param("operation", RandomStringUtils.randomAlphabetic(10)).content(itemsJSONList.getBytes())) .andExpect(status().isBadRequest()); verify(this.dependencyManagerMock, times(0)).update(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); }
From source file:org.craftercms.studio.controller.services.rest.DependencyControllerTest.java
@Test public void testUpdateMissingOperation() throws Exception { doAnswer(new Answer<Void>() { @Override/* ww w . ja v a 2 s . co m*/ public Void answer(InvocationOnMock invocationOnMock) throws Throwable { Object[] args = invocationOnMock.getArguments(); return null; } }).when(this.dependencyManagerMock).update(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); String itemsJSONList = generateRequestBody(generateItemListMock()); this.mockMvc.perform(post("/api/1/dependency/update/sample").accept(MediaType.ALL).param("itemId", "1") .content(itemsJSONList.getBytes())).andExpect(status().isBadRequest()); verify(this.dependencyManagerMock, times(0)).update(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); }
From source file:org.craftercms.studio.controller.services.rest.DependencyControllerTest.java
@Test public void testUpdateMissingDependencies() throws Exception { doAnswer(new Answer<Void>() { @Override/* w w w.ja v a2s.c o m*/ public Void answer(InvocationOnMock invocationOnMock) throws Throwable { Object[] args = invocationOnMock.getArguments(); return null; } }).when(this.dependencyManagerMock).update(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); this.mockMvc.perform(post("/api/1/dependency/update/sample").accept(MediaType.ALL).param("itemId", "1") .param("operation", RandomStringUtils.randomAlphabetic(10)).content(StringUtils.EMPTY.getBytes())) .andExpect(status().isBadRequest()); verify(this.dependencyManagerMock, times(0)).update(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyListOf(Item.class)); }
From source file:org.craftercms.studio.controller.services.rest.DeploymentControllerTest.java
@Test public void testHistory() throws Exception { when(this.deploymentManagerMock.history(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyListOf(String.class))).thenReturn(generateDeploymentHistory()); this.mockMvc.perform(get("/api/1/deployment/history/sample").accept(MediaType.ALL)) .andExpect(status().isOk()); verify(this.deploymentManagerMock, times(1)).history(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyListOf(String.class)); }
From source file:org.craftercms.studio.controller.services.rest.DeploymentControllerTest.java
@Test public void testHistoryWithFilters() throws Exception { when(this.deploymentManagerMock.history(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyListOf(String.class))).thenReturn(generateDeploymentHistory()); this.mockMvc.perform(get("/api/1/deployment/history/sample").param("filters", "filter1", "filter2") .accept(MediaType.ALL)).andExpect(status().isOk()); verify(this.deploymentManagerMock, times(1)).history(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyListOf(String.class)); }
From source file:org.craftercms.studio.controller.services.rest.DeploymentControllerTest.java
@Test public void testChannels() throws Exception { when(this.deploymentManagerMock.channels(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString())).thenReturn(generateChannelsList()); this.mockMvc//from w ww .j a v a2 s. c o m .perform(get("/api/1/deployment/channels/sample") .param("environment", RandomStringUtils.randomAlphabetic(10)).accept(MediaType.ALL)) .andExpect(status().isOk()); verify(this.deploymentManagerMock, times(1)).channels(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString()); }
From source file:org.craftercms.studio.controller.services.rest.DeploymentControllerTest.java
@Test public void testChannelsMissingEnvironment() throws Exception { when(this.deploymentManagerMock.channels(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString())).thenReturn(generateChannelsList()); this.mockMvc.perform(get("/api/1/deployment/channels/sample").accept(MediaType.ALL)) .andExpect(status().isBadRequest()); verify(this.deploymentManagerMock, times(0)).channels(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString());/* ww w . j av a2 s . com*/ }