From 4c47f1f9e256e360ec9b1ad0aca440b48f431b72 Mon Sep 17 00:00:00 2001 From: JanAmeis <162981643+WorkingAmeise@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:24:42 +0100 Subject: [PATCH] #827: Made status commandlet available outside of IDE_HOME (#885) --- .../ide/commandlet/StatusCommandlet.java | 6 ++++ .../ide/commandlet/StatusCommandletTest.java | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 cli/src/test/java/com/devonfw/tools/ide/commandlet/StatusCommandletTest.java diff --git a/cli/src/main/java/com/devonfw/tools/ide/commandlet/StatusCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/commandlet/StatusCommandlet.java index ea47bac6c..b706d944a 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/commandlet/StatusCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/commandlet/StatusCommandlet.java @@ -80,4 +80,10 @@ private void logOnlineStatus() { this.context.warning("You are offline. Check your internet connection and potential proxy settings."); } } + + @Override + public boolean isIdeRootRequired() { + + return false; + } } diff --git a/cli/src/test/java/com/devonfw/tools/ide/commandlet/StatusCommandletTest.java b/cli/src/test/java/com/devonfw/tools/ide/commandlet/StatusCommandletTest.java new file mode 100644 index 000000000..f9ba353a1 --- /dev/null +++ b/cli/src/test/java/com/devonfw/tools/ide/commandlet/StatusCommandletTest.java @@ -0,0 +1,29 @@ +package com.devonfw.tools.ide.commandlet; + +import org.junit.jupiter.api.Test; + +import com.devonfw.tools.ide.cli.CliArguments; +import com.devonfw.tools.ide.context.AbstractIdeContextTest; +import com.devonfw.tools.ide.context.IdeTestContext; + +/** + * Test of {@link StatusCommandlet}. + */ +public class StatusCommandletTest extends AbstractIdeContextTest { + + private static final String PROJECT_BASIC = "basic"; + + @Test + public void testStatusOutsideOfHome() { + //arrange + IdeTestContext context = new IdeTestContext(); + CliArguments args = new CliArguments("status"); + args.next(); + + //act + context.run(args); + + //assert + assertThat(context).logAtWarning().hasMessageContaining("You are not inside an IDE installation: "); + } +}