forked from devonfw/IDEasy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
devonfw#127: Increase commandlet test coverage for EnvironmentCommand…
…let and ContextCommandlet (devonfw#144)
- Loading branch information
1 parent
d2d4920
commit a5f7202
Showing
3 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
cli/src/test/java/com/devonfw/tools/ide/commandlet/ContextCommandletTest.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,55 @@ | ||
package com.devonfw.tools.ide.commandlet; | ||
|
||
import java.util.Locale; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.devonfw.tools.ide.context.AbstractIdeContext; | ||
import com.devonfw.tools.ide.context.AbstractIdeContextTest; | ||
import com.devonfw.tools.ide.context.IdeContextConsole; | ||
|
||
public class ContextCommandletTest extends AbstractIdeContextTest { | ||
|
||
/** | ||
* Test of {@link ContextCommandlet} has name context. | ||
*/ | ||
@Test | ||
public void testNameIsContext(){ | ||
//arrange | ||
ContextCommandlet cxt = new ContextCommandlet(); | ||
//act & assert | ||
assertThat(cxt.getName()).isEqualTo("context"); | ||
} | ||
|
||
/** | ||
* Test of {@link ContextCommandlet} does not require home. | ||
*/ | ||
@Test | ||
public void testThatHomeIsNotReqired() { | ||
|
||
// arrange | ||
ContextCommandlet cxt = new ContextCommandlet(); | ||
//act & assert | ||
assertThat(cxt.isIdeHomeRequired()).isFalse(); | ||
} | ||
|
||
/** | ||
* Test of {@link ContextCommandlet} run. | ||
*/ | ||
@Test | ||
public void testRun() { | ||
|
||
// arrange | ||
ContextCommandlet cxt = new ContextCommandlet(); | ||
// act | ||
cxt.run(); | ||
// assert | ||
assertThat(cxt.getIdeContext()).isInstanceOf(IdeContextConsole.class); | ||
assertThat(cxt.getIdeContext().isForceMode()).isFalse(); | ||
assertThat(cxt.getIdeContext().isBatchMode()).isFalse(); | ||
assertThat(cxt.getIdeContext().isQuietMode()).isFalse(); | ||
assertThat(cxt.getIdeContext().isOfflineMode()).isFalse(); | ||
assertThat(cxt.getIdeContext().getLocale()).isEqualTo(Locale.getDefault()); | ||
|
||
} | ||
} |
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