-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
b1493b6
commit cbe6e88
Showing
9 changed files
with
176 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
cli/src/test/java/com/devonfw/tools/ide/environment/EnvironmentVariablesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.devonfw.tools.ide.environment; | ||
|
||
import com.devonfw.tools.ide.context.AbstractIdeContextTest; | ||
import com.devonfw.tools.ide.context.IdeTestContext; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Test of {@link EnvironmentVariables}. | ||
*/ | ||
public class EnvironmentVariablesTest extends AbstractIdeContextTest { | ||
|
||
/** | ||
* Test of {@link EnvironmentVariables#resolve(String, Object)} with self referencing variables. | ||
*/ | ||
@Test | ||
public void testProperEvaluationOfVariables() { | ||
|
||
// arrange | ||
String path = "workspaces/foo-test/my-git-repo"; | ||
IdeTestContext context = newContext(PROJECT_BASIC, path, false); | ||
EnvironmentVariables variables = context.getVariables(); | ||
|
||
// act | ||
String TEST_ARGS1 = variables.get("TEST_ARGS1"); | ||
String TEST_ARGS2 = variables.get("TEST_ARGS2"); | ||
String TEST_ARGS3 = variables.get("TEST_ARGS3"); | ||
String TEST_ARGS4 = variables.get("TEST_ARGS4"); | ||
String TEST_ARGS5 = variables.get("TEST_ARGS5"); | ||
String TEST_ARGS6 = variables.get("TEST_ARGS6"); | ||
String TEST_ARGS7 = variables.get("TEST_ARGS7"); | ||
String TEST_ARGS8 = variables.get("TEST_ARGS8"); | ||
String TEST_ARGS9 = variables.get("TEST_ARGS9"); | ||
String TEST_ARGS10 = variables.get("TEST_ARGS10"); | ||
// some more advanced cases | ||
String TEST_ARGSa = variables.get("TEST_ARGSa"); | ||
String TEST_ARGSb = variables.get("TEST_ARGSb"); | ||
String TEST_ARGSc = variables.get("TEST_ARGSc"); | ||
String TEST_ARGSd = variables.get("TEST_ARGSd"); | ||
|
||
// assert | ||
assertThat(TEST_ARGS1).isEqualTo(" user1 settings1 workspace1 conf1"); | ||
assertThat(TEST_ARGS2).isEqualTo(" user2 conf2"); | ||
assertThat(TEST_ARGS3).isEqualTo(" user3 workspace3"); | ||
assertThat(TEST_ARGS4).isEqualTo(" settings4"); | ||
assertThat(TEST_ARGS5).isEqualTo(" settings5 conf5"); | ||
assertThat(TEST_ARGS6).isEqualTo(" settings6 workspace6 conf6"); | ||
|
||
assertThat(TEST_ARGS7).isEqualTo("user7 settings7 workspace7 conf7"); | ||
assertThat(TEST_ARGS8).isEqualTo("settings8 workspace8 conf8"); | ||
assertThat(TEST_ARGS9).isEqualTo("settings9 workspace9"); | ||
assertThat(TEST_ARGS10).isEqualTo("user10 workspace10"); | ||
|
||
assertThat(TEST_ARGSa).isEqualTo(" user1 settings1 workspace1 conf1 user3 workspace3 confa"); | ||
assertThat(TEST_ARGSb) | ||
.isEqualTo("user10 workspace10 settingsb user1 settings1 workspace1 conf1 user3 workspace3 confa userb"); | ||
|
||
assertThat(TEST_ARGSc).isEqualTo(" user1 settings1 workspace1 conf1 userc settingsc confc"); | ||
assertThat(TEST_ARGSd).isEqualTo(" user1 settings1 workspace1 conf1 userd workspaced"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
cli/src/test/resources/ide-projects/basic/workspaces/foo-test/ide.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#******************************************************************************** | ||
# Type of {@link EnvironmentVariables} from the | ||
# {@link com.devonfw.tools.ide.context.IdeContext#getWorkspacePath() workspace directory}. | ||
#******************************************************************************** | ||
TEST_ARGS1=${TEST_ARGS1} workspace1 | ||
TEST_ARGS3=${TEST_ARGS3} workspace3 | ||
TEST_ARGS6=${TEST_ARGS6} workspace6 | ||
TEST_ARGS7=${TEST_ARGS7} workspace7 | ||
TEST_ARGS8=${TEST_ARGS8} workspace8 | ||
TEST_ARGS9=${TEST_ARGS9} workspace9 | ||
TEST_ARGS10=${TEST_ARGS10} workspace10 | ||
TEST_ARGSd=${TEST_ARGSd} workspaced |