diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 473dd4d..eed5c5c 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -1,4 +1,5 @@ import java.io.IOException; +import java.util.List; public class Main { public static void main(String[] args) { @@ -8,13 +9,28 @@ public class Main { try { // Instantiate the parser Parser parser = new Parser(filePath); - - // TODO: You can test your code here before you run the unit tests. - // Example: Call your sorting methods, iterate through the returned list, - // and print out the movies to see if they match the expected results in the Help folder. - + + System.out.println("--- Movies Sorted By Title ---"); + List sortedByTitle = parser.sortByTitle(); + for (Movie movie : sortedByTitle) { + System.out.println(movie.toString()); + } + + // Testing sortByRating + System.out.println("\n--- Movies Sorted By Rating (Descending) ---"); + List sortedByRating = parser.sortByRating(); + for (Movie movie : sortedByRating) { + System.out.println(movie.toString()); + } + + // Testing sortByYear + System.out.println("\n--- Movies Sorted By Year (Descending) ---"); + List sortedByYear = parser.sortByYear(); + for (Movie movie : sortedByYear) { + System.out.println(movie.toString()); + } System.out.println("Movies parsed successfully! Total movies: " + parser.sortByTitle().size()); - + } catch (IOException e) { System.err.println("Error reading or parsing the HTML file: " + e.getMessage()); }