Search in sources :

Example 16 with ExecHelper

use of com.redhat.devtools.intellij.common.utils.ExecHelper in project intellij-tekton by redhat-developer.

the class TknCliTest method checkRightArgsWhenStartingTaskWithParameters.

@Test
public void checkRightArgsWhenStartingTaskWithParameters() throws IOException {
    Map<String, Input> params = new HashMap<>();
    params.put("param1", new Input("param1", "string", Input.Kind.PARAMETER, "value1", Optional.empty(), Optional.empty()));
    params.put("param2", new Input("param2", "string", Input.Kind.PARAMETER, "value2", Optional.empty(), Optional.empty()));
    MockedStatic<ExecHelper> exec = mockStatic(ExecHelper.class);
    exec.when(() -> ExecHelper.execute(anyString(), anyMap(), any())).thenReturn("");
    tkn.startTask("ns", "name", params, Collections.emptyMap(), Collections.emptyMap(), "", Collections.emptyMap(), "");
    exec.verify(() -> ExecHelper.execute(anyString(), anyMap(), eq("task"), eq("start"), eq("name"), eq("-n"), eq("ns"), eq("-p"), eq("param1=value1"), eq("-p"), eq("param2=value2"), eq(FLAG_SKIP_OPTIONAL_WORKSPACES)));
    exec.close();
}
Also used : ExecHelper(com.redhat.devtools.intellij.common.utils.ExecHelper) Input(com.redhat.devtools.intellij.tektoncd.tkn.component.field.Input) HashMap(java.util.HashMap) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Aggregations

ExecHelper (com.redhat.devtools.intellij.common.utils.ExecHelper)16 Test (org.junit.Test)16 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)16 HashMap (java.util.HashMap)9 Input (com.redhat.devtools.intellij.tektoncd.tkn.component.field.Input)6 Workspace (com.redhat.devtools.intellij.tektoncd.tkn.component.field.Workspace)6