34 lines
1.3 KiB
Java
34 lines
1.3 KiB
Java
import java.io.IOException;
|
|
|
|
public class Main {
|
|
public static void main(String[] args) {
|
|
// The relative path automatically points to the resources folder
|
|
String filePath = "src/main/resources/Movies.html";
|
|
|
|
try {
|
|
// Instantiate the parser
|
|
Parser parser = new Parser(filePath);
|
|
|
|
// TODO: You can test your code here before you run the unit tests.
|
|
System.out.println("=== Sort By Title ===");
|
|
for (Movie movie : parser.sortByTitle()) {
|
|
System.out.println(movie);
|
|
}
|
|
System.out.println();
|
|
System.out.println("=== Sort By Rating ===");
|
|
for (Movie movie : parser.sortByRating()) {
|
|
System.out.println(movie);
|
|
}
|
|
System.out.println();
|
|
System.out.println("=== Sort By Year ===");
|
|
for (Movie movie : parser.sortByYear()) {
|
|
System.out.println(movie);}
|
|
System.out.println();
|
|
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());
|
|
}
|
|
}
|
|
}
|