Skip to content

Commit

Permalink
Adjust tests to the previous changes
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungerDryas89 committed Nov 13, 2024
1 parent c0af3d1 commit 4784cd7
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ public static void initialize() {
String searchString = parser.createSearchString(file);
try {
SearchResult[] searchResults = parser.getSearchResults(searchString);
Document document = SiteParsingProfile.getDocument(searchResults[0]);
var response = SiteParsingProfile.getDocument(searchResults[0]);
if(response.statusCode() == 200)
throw new RuntimeException(String.valueOf(response.statusCode()));
Document document = response.parse();
parser.setDocument(document);
} catch (IOException e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ public static void initialize() {
String searchString = parser.createSearchString(file);
try {
SearchResult[] searchResults = parser.getSearchResults("122716_008");
Document document = SiteParsingProfile.getDocument(searchResults[0]);

var response = SiteParsingProfile.getDocument(searchResults[0]);
if(response.statusCode() == 200)
throw new RuntimeException(String.valueOf(response.statusCode()));
Document document = response.parse();
System.out.println("Scrape: " + document.location());
parser.setDocument(document);
parser.prepareData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ public static void initialize() {
String searchString = profile.createSearchString(file);
System.out.println("searchString = " + searchString);
try {
SearchResult[] searchResults = profile.getSearchResults(searchString);
Document document = SiteParsingProfile.getDocument(searchResults[0]);
System.out.println("document set to " + document.baseUri());
profile.setDocument(document);
var response = SiteParsingProfile.getDocument(profile.getSearchResults(searchString)[0]);
if(response.statusCode() == 200)
throw new RuntimeException(String.valueOf(response.statusCode()));

Document doc = response.parse();
profile.setDocument(doc);
System.out.println("document set to " + doc.baseUri());
profile.prepareData();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package moviescraper.doctord.controller.siteparsingprofile;

import org.jsoup.nodes.Document;
import org.junit.BeforeClass;
import org.junit.Test;

Expand All @@ -14,7 +15,10 @@ public class MissAVParsingProfileTest {
public static void initialize() throws IOException {
parser = new moviescraper.doctord.controller.siteparsingprofile.specific.MissAVParsingProfile();
var result = parser.getSearchResults(parser.createSearchStringFromId("DANDY-680"));
parser.setDocument(SiteParsingProfile.getDocument(result[0]));
var response = SiteParsingProfile.getDocument(result[0]);
if(response.statusCode() == 200)
throw new RuntimeException(String.valueOf(response.statusCode()));
parser.setDocument(response.parse());
parser.prepareData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public static void initialize() {
String searchString = parser.createSearchString(file);
try {
SearchResult[] searchResults = parser.getSearchResults(searchString);
Document document = SiteParsingProfile.getDocument(searchResults[0]);
var response = SiteParsingProfile.getDocument(searchResults[0]);
if(response.statusCode() == 200)
throw new RuntimeException(String.valueOf(response.statusCode()));
Document document = response.parse();
parser.setDocument(document);
} catch (IOException e) {
// TODO Auto-generated catch block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ public class NJavParsingProfileTest {
public static void initialize() throws IOException {
parser = new NJavParsingProfile();
var result = parser.getSearchResults("siro-5283");
var doc = SiteParsingProfile.getDocument(result[0]);
parser.setDocument(doc);
var response = SiteParsingProfile.getDocument(result[0]);
if(response.statusCode() == 200)
throw new RuntimeException(String.valueOf(response.statusCode()));
parser.setDocument(response.parse());
parser.prepareData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ public static void initialize() {
profile = new OnePondoParsingProfile();
String searchString = profile.createSearchString(file);
System.out.println(searchString);
Document document;
try {
document = profile.getDocument(searchString);
profile.setDocument(document);
var response = profile.getDocument(searchString);
if(response.statusCode() == 200)
throw new RuntimeException(String.valueOf(response.statusCode()));
profile.setDocument(response.parse());
} catch (IOException ex) {
Logger.getLogger(OnePondoParsingProfileTest.class.getName()).log(Level.SEVERE, null, ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public static void initialize(){
profile = new SquarePlusParsingProfile();
var searchString = profile.createSearchStringFromId(fn);
try {
profile.setDocument(
SiteParsingProfile.getDocument(
profile.getSearchResults(searchString)[0]
)
);
var response = SiteParsingProfile.getDocument(profile.getSearchResults(searchString)[0]);
if(response.statusCode() == 200)
throw new RuntimeException(String.valueOf(response.statusCode()));
profile.setDocument(response.parse());
profile.prepareData();
} catch (IOException e){
System.err.println(e.getMessage());
}
Expand Down

0 comments on commit 4784cd7

Please sign in to comment.