Skip to content

Commit

Permalink
#424: stepwise re-adding small changes to see if they break tests on …
Browse files Browse the repository at this point in the history
…github or not (#560)
  • Loading branch information
hohwille authored Aug 26, 2024
1 parent 2e03651 commit 44d5f02
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@
import java.util.Collections;
import java.util.List;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

import com.devonfw.tools.ide.cli.CliArguments;
import com.devonfw.tools.ide.commandlet.Commandlet;
import com.devonfw.tools.ide.commandlet.ContextCommandlet;
import com.devonfw.tools.ide.context.AbstractIdeContext;
import com.devonfw.tools.ide.context.IdeTestContextMock;
import com.devonfw.tools.ide.context.IdeContextTest;
import com.devonfw.tools.ide.property.Property;

/**
* Test of {@link AbstractIdeContext#complete(CliArguments, boolean) auto-completion}.
*/
public class CompleteTest extends Assertions {
public class CompleteTest extends IdeContextTest {

/** Test of {@link AbstractIdeContext#complete(CliArguments, boolean) auto-completion} for empty input. */
@Test
public void testCompleteEmpty() {

// arrange
boolean includeContextOptions = true;
AbstractIdeContext context = IdeTestContextMock.get();
AbstractIdeContext context = newContext(PROJECT_BASIC, null, false);
CliArguments args = CliArguments.ofCompletion("");
args.next();
List<String> expectedCandidates = getExpectedCandidates(context, true, includeContextOptions, true);
Expand All @@ -42,7 +41,7 @@ public void testCompleteEmptyNoCtxOptions() {

// arrange
boolean includeContextOptions = false;
AbstractIdeContext context = IdeTestContextMock.get();
AbstractIdeContext context = newContext(PROJECT_BASIC, null, false);
CliArguments args = CliArguments.ofCompletion("");
args.next();
List<String> expectedCandidates = getExpectedCandidates(context, true, includeContextOptions, true);
Expand All @@ -58,7 +57,7 @@ public void testCompleteEmptyNoCtxOptions() {
public void testCompleteCommandletFirstLetter() {

// arrange
AbstractIdeContext context = IdeTestContextMock.get();
AbstractIdeContext context = newContext(PROJECT_BASIC, null, false);
CliArguments args = CliArguments.ofCompletion("h");
// act
List<CompletionCandidate> candidates = context.complete(args, true);
Expand All @@ -71,7 +70,7 @@ public void testCompleteCommandletFirstLetter() {
public void testCompleteShortOptsCombined() {

// arrange
AbstractIdeContext context = IdeTestContextMock.get();
AbstractIdeContext context = newContext(PROJECT_BASIC, null, false);
CliArguments args = CliArguments.ofCompletion("-f");
// act
List<CompletionCandidate> candidates = context.complete(args, true);
Expand All @@ -85,7 +84,7 @@ public void testCompleteShortOptsCombined() {
public void testCompleteShortOptsCombinedAllButVersion() {

// arrange
AbstractIdeContext context = IdeTestContextMock.get();
AbstractIdeContext context = newContext(PROJECT_BASIC, null, false);
CliArguments args = CliArguments.ofCompletion("-fbdoqt");
// act
List<CompletionCandidate> candidates = context.complete(args, true);
Expand All @@ -98,7 +97,7 @@ public void testCompleteShortOptsCombinedAllButVersion() {
public void testCompleteHelpEmptyArgs() {

// arrange
AbstractIdeContext context = IdeTestContextMock.get();
AbstractIdeContext context = newContext(PROJECT_BASIC, null, false);
CliArguments args = CliArguments.ofCompletion("help", "");
List<String> expectedCandidates = getExpectedCandidates(context, true, false, false);
// act
Expand All @@ -113,7 +112,7 @@ public void testCompleteHelpEmptyArgs() {
public void testCompleteVersionNoMoreArgs() {

// arrange
AbstractIdeContext context = IdeTestContextMock.get();
AbstractIdeContext context = newContext(PROJECT_BASIC, null, false);
CliArguments args = CliArguments.ofCompletion("--version", "");
// act
List<CompletionCandidate> candidates = context.complete(args, true);
Expand Down

0 comments on commit 44d5f02

Please sign in to comment.