Develop #1
+22
-6
@@ -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<Movie> sortedByTitle = parser.sortByTitle();
|
||||
for (Movie movie : sortedByTitle) {
|
||||
System.out.println(movie.toString());
|
||||
}
|
||||
|
||||
// Testing sortByRating
|
||||
System.out.println("\n--- Movies Sorted By Rating (Descending) ---");
|
||||
List<Movie> sortedByRating = parser.sortByRating();
|
||||
for (Movie movie : sortedByRating) {
|
||||
System.out.println(movie.toString());
|
||||
}
|
||||
|
||||
// Testing sortByYear
|
||||
System.out.println("\n--- Movies Sorted By Year (Descending) ---");
|
||||
List<Movie> 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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user