Created
November 1, 2018 03:45
-
-
Save dejanvasic85/1d2894909dd1a62a02b386f0774f4531 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PageBrowser() implements AutoCloseable { | |
final SeleniumDriver mDriver; | |
public PageBrowser() { | |
mDriver = new SeleniumDriver(); // setup the rest of the driver | |
} | |
TPage <TPage> goTo() { | |
// Todo Java Reflection on TPage and inject SeleniumDriver | |
} | |
@Override | |
close() { | |
mDriver.close(); | |
} | |
} | |
// How to resolve wager: | |
try (PageBrowser browser = new PageBrowser()) { | |
ApiClient api = new ApiClient(); | |
List<Wager> wagers = api.getFootballWagers(); | |
SoccerResultsPage soccerResults = browser.goTo<SoccerResults>(); | |
List<Result> results = soccerResults.getTodaysResults(); | |
// todo - loop through results and match them with wager (if any) | |
foreach (Result r : results) { | |
Wager w = wagers.stream().filter(w -> w.getDescription == r.fixtureName).findFirst(); | |
if (w.exists() { | |
w.resolveWithFixture(r); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment