MetadataClient extends ClientBase { public void unregisterWorkflowDef(String name, Integer version) { Preconditions.checkArgument(StringUtils.isNotBlank(name), "Workflow name cannot be blank"); Preconditions.checkNotNull(version, "Version cannot be null"); delete("metadata/workflow/{name}/{version}", name, version); } MetadataClient();  MetadataClient(ClientConfig clientConfig);  MetadataClient(ClientConfig clientConfig, ClientHandler clientHandler);  MetadataClient(ClientConfig config, ClientHandler handler, ClientFilter... filters);  MetadataClient(ClientConfig config, ConductorClientConfiguration clientConfiguration, ClientHandler handler, ClientFilter... filters); void registerWorkflowDef(WorkflowDef workflowDef); void updateWorkflowDefs(List<WorkflowDef> workflowDefs); WorkflowDef getWorkflowDef(String name, Integer version); void unregisterWorkflowDef(String name, Integer version); void registerTaskDefs(List<TaskDef> taskDefs); void updateTaskDef(TaskDef taskDef); TaskDef getTaskDef(String taskType); void unregisterTaskDef(String taskType);  }
@Test public void testWorkflowDelete() { MetadataClient mockClient = Mockito.mock(MetadataClient.class); mockClient.unregisterWorkflowDef("hello", 1); verify(mockClient, times(1)).unregisterWorkflowDef(anyString(), any()); }
@Test public void testWorkflowDeleteThrowException() { MetadataClient mockClient = Mockito.mock(MetadataClient.class); expectedException.expect(RuntimeException.class); expectedException.expectMessage("Invalid Workflow name"); doThrow(new RuntimeException("Invalid Workflow name")).when(mockClient).unregisterWorkflowDef(anyString(), any()); mockClient.unregisterWorkflowDef("hello", 1); }
@Test public void testWorkflowDeleteVersionMissing() { expectedException.expect(NullPointerException.class); expectedException.expectMessage("Version cannot be null"); metadataClient.unregisterWorkflowDef("hello", null); }
@Test public void testWorkflowDeleteNameMissing() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Workflow name cannot be blank"); metadataClient.unregisterWorkflowDef(null, 1); }