Skip to content

Commit

Permalink
devonfw#608: optimized Dotnet test
Browse files Browse the repository at this point in the history
moved windows test to parameterized tests
  • Loading branch information
jan-vcapgemini committed Oct 7, 2024
1 parent b786464 commit 11dfda2
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import java.nio.file.Path;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import com.devonfw.tools.ide.context.AbstractIdeContextTest;
import com.devonfw.tools.ide.context.IdeTestContext;
import com.devonfw.tools.ide.os.SystemInfo;
import com.devonfw.tools.ide.os.SystemInfoImpl;
import com.devonfw.tools.ide.os.SystemInfoMock;

public class DotNetTest extends AbstractIdeContextTest {
Expand Down Expand Up @@ -51,28 +49,21 @@ public void dotnetShouldInstallSuccessful(String os) {
assertThat(this.context).logAtSuccess().hasMessage("Successfully installed dotnet in version 6.0.419");
}

@Test
public void dotnetShouldRunExecutableForWindowsSuccessful() {

String expectedOutputWindows = "Dummy dotnet 6.0.419 on windows ";
if (SystemInfoImpl.INSTANCE.isWindows()) {
runExecutable("windows");
checkExpectedOutput(expectedOutputWindows);
}
}

@ParameterizedTest
@ValueSource(strings = { "mac", "linux" })
@ValueSource(strings = { "windows", "mac", "linux" })
public void dotnetShouldRunExecutableSuccessful(String os) {

String expectedOutputLinux = "Dummy dotnet 6.0.419 on linux ";
String expectedOutputMacOs = "Dummy dotnet 6.0.419 on mac ";
String expectedOutputWindows = "Dummy dotnet 6.0.419 on windows ";
runExecutable(os);

if (this.context.getSystemInfo().isLinux()) {
checkExpectedOutput(expectedOutputLinux);
} else if (this.context.getSystemInfo().isMac()) {
checkExpectedOutput(expectedOutputMacOs);
} else if (this.context.getSystemInfo().isWindows()) {
checkExpectedOutput(expectedOutputWindows);
}
}

Expand Down

0 comments on commit 11dfda2

Please sign in to comment.