From 3a530ec00f047e306eb53961ad71ca67f545773c Mon Sep 17 00:00:00 2001 From: ayalaben Date: Thu, 26 Jul 2018 11:10:49 +0300 Subject: Validator init binder fix Change-Id: I98ac7b42512a4f7b1323e29ed5059553479b24e0 Issue-ID: SDC-1518 Signed-off-by: ayalaben --- .../org/onap/sdc/workflow/api/WorkflowControllerTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'workflow-designer-be/src/test') diff --git a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowControllerTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowControllerTest.java index 5e7df483..337fea79 100644 --- a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowControllerTest.java +++ b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/WorkflowControllerTest.java @@ -257,6 +257,18 @@ public class WorkflowControllerTest { verify(workflowManagerMock).create(reqWorkflow); } + @Test + public void shouldThrowExceptionWhenWorkflowNameInvalid() throws Exception { + + Workflow reqWorkflow = new Workflow(); + reqWorkflow.setName("Invalid workflow name %"); + MockHttpServletResponse response = mockMvc.perform( + post(RestPath.getWorkflowsPath()).header(USER_ID_HEADER_PARAM, USER_ID).contentType(APPLICATION_JSON) + .content(GSON.toJson(reqWorkflow))).andDo(print()) + .andExpect(status().isBadRequest()).andReturn().getResponse(); + assertEquals("Workflow name must contain only letters, digits and underscores", response.getContentAsString()); + } + private List createWorkflows(int numOfWorkflows) { List workflowList = new ArrayList<>(numOfWorkflows); for (int i = 0; i < numOfWorkflows; i++) { -- cgit 1.2.3-korg