Skip to content

Commit

Permalink
Merge pull request #206 from ChinYanXu/UpdateGUI
Browse files Browse the repository at this point in the history
Update UserGuide for clarity
  • Loading branch information
EugeneChanJiajun committed Apr 8, 2024
2 parents 89ebba8 + 8fb864d commit 2b3d8e8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ list via a Command Line Interface**.

5. Use the java -jar omni.jar command to run the application.

6. A GUI similar to the below should appear in a few seconds.
6. A welcome message similar to the one below should appear in a few seconds.
```
No existing database found! Creating a new save file for you!
____________________________________________________________
Expand Down
4 changes: 4 additions & 0 deletions omni.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
landmark / 0 / Eiffel Tower / 2025-03-14 / 2 hours / go up tower / $20
food / 0 / Mala Hotpot / 2025-03-14 / 2 hours / very spicy / $50
accommodation / 0 / Four Seasons Hotel / 2025-08-25 / 2 weeks / first hotel / $70
general / 0 / Go to Hong Kong / 2025-08-25 / 6 hours / with family /
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.logging.Level;
import java.util.logging.Logger;


Expand Down Expand Up @@ -350,6 +351,7 @@ public void totalExpense(String type) throws OmniException {
expense = expense.substring(1);
}
tot += Double.parseDouble(expense);
logger.log(Level.INFO, String.valueOf(tot));
}
}
}
Expand Down
42 changes: 42 additions & 0 deletions src/test/java/seedu/omnitravel/OmniTravelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

class OmniTravelTest {


Accommodation accommodationNew1 = new Accommodation("nus rvrc", LocalDate.parse("2007-12-12"),
"5 years", "campus stay", "");
Accommodation accommodationNew2 = new Accommodation("nus pgpr", LocalDate.parse("2017-10-12"),
Expand Down Expand Up @@ -314,6 +315,47 @@ public void testRemoveExpense() throws OmniException {
assertEquals("visit museum", list.getDescription("visit museum"));
}

@Test
public void testTotalExpanseAll() throws OmniException{
TravelActivityList list = new TravelActivityList();
list.addTravelActivity(new TravelActivity("visit museum",
LocalDate.parse("2019-05-12"),"2hours", "Sightseeing", "$20"));
list.totalExpense("all");

String findExpectedOutput = "The total expense for all travel activities is: $20.0";
assertEquals(capturedOutputStream.toString().trim(), findExpectedOutput);
}

@Test
public void testTotalExpanseAccommodation() throws OmniException{
TravelActivityList list = new TravelActivityList();
list.addTravelActivity(new Accommodation("RVRC", LocalDate.parse("2022-07-12"), "3hours",
"hostel", "$70"));
String findExpectedOutput1 = "The total expense for Accommodation travel activities is: $70.0";
list.totalExpense("Accommodation");
assertEquals(capturedOutputStream.toString().trim(), findExpectedOutput1);
}

@Test
public void testTotalExpanseFood() throws OmniException{
TravelActivityList list = new TravelActivityList();
list.addTravelActivity(new Food("UTOWN Flavours", LocalDate.parse("2024-05-12"), "1 hours",
"lunch", "$10"));
String findExpectedOutput2 = "The total expense for Food travel activities is: $10.0";
list.totalExpense("Food");
assertEquals(capturedOutputStream.toString().trim(), findExpectedOutput2);
}

@Test
public void testTotalExpanseLandmark() throws OmniException{
TravelActivityList list = new TravelActivityList();
list.addTravelActivity(new Landmark("Berlin Wall", LocalDate.parse("2024-08-14"), "1 hours",
"sightseeig", "$5"));
String findExpectedOutput2 = "The total expense for Landmark travel activities is: $5.0";
list.totalExpense("Landmark");
assertEquals(capturedOutputStream.toString().trim(), findExpectedOutput2);
}

@Test

public void testListTags() throws OmniException {
Expand Down

0 comments on commit 2b3d8e8

Please sign in to comment.