File tree 3 files changed +28
-5
lines changed
main/java/com/devonfw/tools/ide/commandlet
test/java/com/devonfw/tools/ide/commandlet
3 files changed +28
-5
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -43,6 +43,14 @@ public void run() {
43
43
logSettingsLegacyStatus ();
44
44
logMigrationStatus ();
45
45
}
46
+ checkForUpdate ();
47
+ }
48
+
49
+ private void checkForUpdate () {
50
+ if (!this .context .isOnline ()) {
51
+ this .context .warning ("Check for newer version of IDEasy is skipped due to no network connectivity." );
52
+ return ;
53
+ }
46
54
new IdeasyCommandlet (this .context , null ).checkIfUpdateIsAvailable ();
47
55
logSystemInfo ();
48
56
}
Original file line number Diff line number Diff line change 2
2
3
3
import org .junit .jupiter .api .Test ;
4
4
5
- import com .devonfw .tools .ide .cli .CliArguments ;
6
5
import com .devonfw .tools .ide .context .AbstractIdeContextTest ;
7
6
import com .devonfw .tools .ide .context .IdeTestContext ;
8
7
@@ -17,13 +16,30 @@ public class StatusCommandletTest extends AbstractIdeContextTest {
17
16
public void testStatusOutsideOfHome () {
18
17
//arrange
19
18
IdeTestContext context = new IdeTestContext ();
20
- CliArguments args = new CliArguments ("status" );
21
- args .next ();
19
+ StatusCommandlet status = context .getCommandletManager ().getCommandlet (StatusCommandlet .class );
22
20
23
21
//act
24
- context .run (args );
22
+ status .run ();
25
23
26
24
//assert
27
25
assertThat (context ).logAtWarning ().hasMessageContaining ("You are not inside an IDE project: " );
28
26
}
27
+
28
+ /**
29
+ * Tests the output if {@link StatusCommandlet} is run without internet connection.
30
+ */
31
+ @ Test
32
+ public void testStatusWhenOffline () {
33
+
34
+ // arrange
35
+ IdeTestContext context = new IdeTestContext ();
36
+ context .setOnline (false );
37
+ StatusCommandlet status = context .getCommandletManager ().getCommandlet (StatusCommandlet .class );
38
+
39
+ // act
40
+ status .run ();
41
+
42
+ // assert
43
+ assertThat (context ).logAtWarning ().hasMessage ("Check for newer version of IDEasy is skipped due to no network connectivity." );
44
+ }
29
45
}
You can’t perform that action at this time.
0 commit comments