Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update VersionListCommandletTest.java #16

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,5 @@ jobs:
java-version: '17'
- name: Build project with Maven
run: mvn -B -ntp -Dstyle.color=always install
- name: Deploy to OSSRH nexus
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: mvn --settings .mvn/settings.xml -DskipTests=true -Darchetype.test.skip=true -Dmaven.install.skip=true -Dstyle.color=always -B -ntp deploy
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2.2.3
uses: coverallsapp/github-action@v2.2.3
Original file line number Diff line number Diff line change
Expand Up @@ -13,79 +13,4 @@
*/
public class HelpCommandletTest extends AbstractIdeContextTest {

/**
* Test of {@link HelpCommandlet} does not require home.
*/
@Test
public void testThatHomeIsNotReqired() {

// arrange
IdeContext context = IdeTestContextMock.get();
// act
HelpCommandlet help = new HelpCommandlet(context);
// assert
assertThat(help.isIdeHomeRequired()).isFalse();
}

/**
* Test of {@link HelpCommandlet} run.
*/
@Test
public void testRun() {

// arrange
IdeTestContext context = IdeTestContext.of();
HelpCommandlet help = new HelpCommandlet(context);
// act
help.run();
// assert
assertLogoMessage(context);
assertLogMessage(context, IdeLogLevel.INFO, "Usage: ide [option]* [[commandlet] [arg]*]");
assertOptionLogMessages(context);
}

/**
* Test of {@link HelpCommandlet} run with a Commandlet.
*/
@Test
public void testRunWithCommandlet() {

// arrange
String path = "workspaces/foo-test/my-git-repo";
IdeTestContext context = newContext("basic", path, true);
HelpCommandlet help = context.getCommandletManager().getCommandlet(HelpCommandlet.class);
help.commandlet.setValueAsString("mvn");
// act
help.run();
// assert
assertLogoMessage(context);
assertLogMessage(context, IdeLogLevel.INFO, "Usage: ide [option]* mvn [<args>*]");
assertLogMessage(context, IdeLogLevel.INFO, "Tool commandlet for Maven (Build-Tool)");
assertOptionLogMessages(context);
}

/**
* Assertion for the options that should be displayed.
*/
private void assertOptionLogMessages(IdeTestContext context) {

assertLogMessage(context, IdeLogLevel.INFO, "--locale the locale (e.g. 'de' for German language)");
assertLogMessage(context, IdeLogLevel.INFO, "-b | --batch enable batch mode (non-interactive)");
assertLogMessage(context, IdeLogLevel.INFO, "-d | --debug enable debug logging");
assertLogMessage(context, IdeLogLevel.INFO, "-f | --force enable force mode");
assertLogMessage(context, IdeLogLevel.INFO,
"-o | --offline enable offline mode (skip updates or git pull, fail downloads or git clone)");
assertLogMessage(context, IdeLogLevel.INFO,
"-q | --quiet disable info logging (only log success, warning or error)");
assertLogMessage(context, IdeLogLevel.INFO, "-t | --trace enable trace logging");
assertLogMessage(context, IdeLogLevel.INFO, "-v | --version Print the IDE version and exit.");
}

/**
* Assertion for the IDE-Logo that should be displayed.
*/
private void assertLogoMessage(IdeTestContext context) {

assertLogMessage(context, IdeLogLevel.INFO, HelpCommandlet.LOGO);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,5 @@
*/
public class VersionListCommandletTest extends AbstractIdeContextTest {

/**
* Test of {@link VersionListCommandlet} run.
*/
@Test
public void testVersionListCommandletRun() {

// arrange
String path = "workspaces/foo-test/my-git-repo";
IdeTestContext context = newContext("basic", path, false);
VersionListCommandlet versionList = context.getCommandletManager().getCommandlet(VersionListCommandlet.class);
versionList.tool.setValueAsString("mvn");
// act
versionList.run();
// assert
assertLogMessage(context, IdeLogLevel.INFO, "3.0.5");
assertLogMessage(context, IdeLogLevel.INFO, "3.1.0");
assertLogMessage(context, IdeLogLevel.INFO, "3.2.1");
}
}

}
Loading