Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 8e6040d

Browse files
committed
Update unit tests
1 parent 767b0bb commit 8e6040d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/test/java/unit/com/mathworks/ci/utilities/MatlabCommandRunnerTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
@RunWith(MockitoJUnitRunner.class)
4141
public class MatlabCommandRunnerTest {
4242

43-
@Mock private FilePath workspace;
4443
@Mock private Launcher launcher;
4544
@Mock private ProcStarter procStarter;
4645
private EnvVars env;
@@ -57,14 +56,12 @@ public class MatlabCommandRunnerTest {
5756
public void initialize() throws IOException, InterruptedException {
5857
env = new EnvVars();
5958

60-
when(params.getWorkspace()).thenReturn(workspace);
59+
doReturn(new FilePath(tempDir.getRoot())).when(params).getWorkspace();
6160
when(params.getLauncher()).thenReturn(launcher);
6261
when(params.getEnvVars()).thenReturn(env);
6362
when(params.getTaskListener()).thenReturn(listener);
6463
when(params.getStartupOptions()).thenReturn("");
6564

66-
when(launcher.getChannel()).thenReturn(null);
67-
when(workspace.getRemote()).thenReturn(tempDir.getRoot().getAbsolutePath());
6865
when(listener.getLogger()).thenReturn(logger);
6966

7067
doReturn(false).when(launcher).isUnix();
@@ -87,8 +84,7 @@ public void validConstructorDoesNotThrow() throws IOException, InterruptedExcept
8784
@Test
8885
public void constructorUsesParamsForTempFolder() throws IOException, InterruptedException {
8986
MatlabCommandRunner runner = new MatlabCommandRunner(params);
90-
verify(params, times(1)).getLauncher();
91-
verify(params, times(3)).getWorkspace();
87+
verify(params, times(1)).getWorkspace();
9288
}
9389

9490
@Test
@@ -214,7 +210,7 @@ public void runUsesWorkspaceLocationAsWD() throws IOException, InterruptedExcept
214210

215211
runner.runMatlabCommand("COMMAND");
216212

217-
verify(procStarter).pwd(workspace);
213+
verify(procStarter).pwd(new FilePath(tempDir.getRoot()));
218214
}
219215

220216
@Test

0 commit comments

Comments
 (0)