Skip to content

Commit 6e922e3

Browse files
committed
chore: made package name and folder path lowercase. Also added JavaDoc formatting.
1 parent 358ac58 commit 6e922e3

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.codedifferently.lesson16.NintendoSwitch;
1+
package com.codedifferently.lesson16.nintendoswitch;
22

33
public class InvalidBatteryException extends Exception {
44
public InvalidBatteryException(String message) {
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package com.codedifferently.lesson16.NintendoSwitch;
1+
package com.codedifferently.lesson16.nintendoswitch;
22

33
import java.util.ArrayList;
44

5-
public class NintendoSwitch {
5+
public class nintendo {
66

77
public enum Model {
88
STANDARD,
@@ -18,7 +18,7 @@ public enum Model {
1818
private ArrayList<String> installedGames;
1919

2020
// This will be the constructor for the NintendoSwitch class.
21-
public NintendoSwitch(
21+
public nintendo(
2222
String serialNumber,
2323
Model model,
2424
boolean isDocked,
@@ -37,32 +37,31 @@ public InvalidBatteryException(String message) {
3737
}
3838
}
3939

40-
// Function 1: This will check the battery status. This also has the exception handling.
40+
/** Function 1: This will check the battery status. This also has the exception handling. */
4141
public void checkBatteryStatus() throws InvalidBatteryException {
42-
// Conditional expression checking battery status
42+
/** Conditional expression checking battery status */
4343
if (batteryLife < 0) {
4444
throw new InvalidBatteryException("Battery life cannot be negative.");
4545
}
4646
System.out.println("Battery life: " + batteryLife + " hours.");
4747
}
4848

49-
// Function 2: Adds a game to the installed games collection
49+
/** Function 2: Adds a game to the installed games collection */
5050
public void installGame(String game) {
5151
installedGames.add(game);
5252
System.out.println(game + " has been added to your Nintendo Switch.");
5353
}
5454

55-
// Function 3: Displays all installed games using a loop
55+
/** Function 3: Displays all installed games using a loop */
5656
public void displayInstalledGames() {
5757
System.out.println("Installed games on the Nintendo Switch:");
58-
// Using a normal for loop to iterate over installed games
58+
/** Using a normal for loop to iterate over installed games */
5959
for (int i = 0; i < installedGames.size(); i++) {
6060
System.out.println("- " + installedGames.get(i));
6161
}
6262
}
6363

64-
// Getter methods
65-
64+
/** Getter methods */
6665
public String getSerialNumber() {
6766
return serialNumber;
6867
}

lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/Switch/NintendoSwitchTest.java renamed to lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/nintendoswitch/nintendoswitchtest.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
package com.codedifferently.lesson16.Switch;
1+
package com.codedifferently.lesson16.nintendoswitch;
22

33
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
44
import static org.junit.jupiter.api.Assertions.assertEquals;
55
import static org.junit.jupiter.api.Assertions.assertThrows;
66
import static org.junit.jupiter.api.Assertions.assertTrue;
77

8-
import com.codedifferently.lesson16.NintendoSwitch.NintendoSwitch;
98
import java.io.ByteArrayOutputStream;
109
import java.io.PrintStream;
1110
import java.util.ArrayList;
1211
import org.junit.jupiter.api.BeforeEach;
1312
import org.junit.jupiter.api.Test;
1413

15-
public class NintendoSwitchTest {
14+
public class nintendoswitchtest {
1615

17-
private NintendoSwitch ns;
16+
private nintendo ns;
1817
private ArrayList<String> games;
1918

2019
@BeforeEach
2120
void setUp() {
2221
games = new ArrayList<>();
23-
ns = new NintendoSwitch("SN001", NintendoSwitch.Model.STANDARD, true, 5.0, games);
22+
ns = new nintendo("SN001", nintendo.Model.STANDARD, true, 5.0, games);
2423
}
2524

2625
@Test
@@ -39,11 +38,11 @@ void testCheckBatteryStatusValid() {
3938

4039
@Test
4140
void testCheckBatteryStatusInvalid() {
42-
NintendoSwitch faultySwitch =
43-
new NintendoSwitch("SN002", NintendoSwitch.Model.LITE, false, -2.0, new ArrayList<>());
41+
nintendo faultySwitch =
42+
new nintendo("SN002", nintendo.Model.LITE, false, -2.0, new ArrayList<>());
4443

4544
assertThrows(
46-
NintendoSwitch.InvalidBatteryException.class,
45+
nintendo.InvalidBatteryException.class,
4746
faultySwitch::checkBatteryStatus,
4847
"Negative battery should throw InvalidBatteryException");
4948
}
@@ -63,7 +62,7 @@ void testDisplayInstalledGames() {
6362
assertTrue(printedOutput.contains("Mario Kart"));
6463
assertTrue(printedOutput.contains("Smash Bros"));
6564

66-
System.setOut(System.out); // Reset output
65+
System.setOut(System.out);
6766
}
6867

6968
@Test

0 commit comments

Comments
 (0)