diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/CliWorkplaceCommand.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopCliCommand.kt similarity index 93% rename from src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/CliWorkplaceCommand.kt rename to src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopCliCommand.kt index b9fa504..361280b 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/CliWorkplaceCommand.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopCliCommand.kt @@ -8,7 +8,8 @@ import org.domaindrivenarchitecture.provs.desktop.domain.Scope class DesktopCliCommand( val configFile: ConfigFileName, val scopes: List, - val target: TargetCliCommand, ) { + val target: TargetCliCommand, +) { fun isValid(): Boolean { return configFile.fileName.isNotEmpty() && target.isValid() @@ -18,4 +19,3 @@ class DesktopCliCommand( return scopes.isNotEmpty() } } - diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/application/CliWorkplaceKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/application/CliWorkplaceKtTest.kt index cc7e623..0ae0df2 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/application/CliWorkplaceKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/application/CliWorkplaceKtTest.kt @@ -5,6 +5,8 @@ import io.mockk.every import io.mockk.mockkStatic import io.mockk.unmockkStatic import io.mockk.verify +import org.domaindrivenarchitecture.provs.configuration.domain.ConfigFileName +import org.domaindrivenarchitecture.provs.configuration.domain.TargetCliCommand import org.domaindrivenarchitecture.provs.framework.core.* import org.domaindrivenarchitecture.provs.framework.core.cli.retrievePassword import org.domaindrivenarchitecture.provs.framework.core.processors.PrintOnlyProcessor @@ -26,6 +28,11 @@ internal class CliWorkplaceKtTest { val printOnlyProv = Prov.newInstance(PrintOnlyProcessor()) val testConfig = DesktopConfig(WorkplaceType.MINIMAL, gitUserName = "gittestuser", gitEmail = "git@test.mail") + val cmd = DesktopCliCommand( + ConfigFileName("bla"), + listOf(), + TargetCliCommand(null, null, null, false, null, false) + ) @BeforeAll @JvmStatic @@ -118,7 +125,8 @@ internal class CliWorkplaceKtTest { System.setOut(originalOut) System.setErr(originalErr) - val expectedOutput = "Error: File\u001B[31m ConfigFileName(fileName=idontexist.yaml) \u001B[0m was not found.Pls copy file \u001B[31m WorkplaceConfigExample.yaml \u001B[0m to file \u001B[31m ConfigFileName(fileName=idontexist.yaml) \u001B[0m and change the content according to your needs." + val expectedOutput = + "Error: File\u001B[31m ConfigFileName(fileName=idontexist.yaml) \u001B[0m was not found.Pls copy file \u001B[31m WorkplaceConfigExample.yaml \u001B[0m to file \u001B[31m ConfigFileName(fileName=idontexist.yaml) \u001B[0m and change the content according to your needs." assertEquals(expectedOutput, outContent.toString().replace("\r", "").replace("\n", "")) verify(exactly = 0) { any().provisionWorkplace(any(), cmd = cmd) } @@ -144,7 +152,8 @@ internal class CliWorkplaceKtTest { System.setOut(originalOut) System.setErr(originalErr) - val expectedOutput = "Error: File \"ConfigFileName(fileName=src/test/resources/InvalidWorkplaceConfig.yaml)\" has an invalid format and or invalid data." + val expectedOutput = + "Error: File \"ConfigFileName(fileName=src/test/resources/InvalidWorkplaceConfig.yaml)\" has an invalid format and or invalid data." assertEquals(expectedOutput, outContent.toString().replace("\r", "").replace("\n", "")) verify(exactly = 0) { any().provisionWorkplace(any(), cmd = cmd) }