Skip to content

Commit

Permalink
Fix #248 : L2 injured players fail (maligue2 website)
Browse files Browse the repository at this point in the history
  • Loading branch information
ALIX LOURME - U171755 committed Aug 2, 2023
1 parent a8cfd49 commit b81bb51
Show file tree
Hide file tree
Showing 3 changed files with 1,937 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ protected List<Player> getPlayers(String content) {
List<Player> players = new ArrayList<>();
Document doc = Jsoup.parse(content);
for (Element item : doc.select("tr")) {
if (item.selectFirst("th.column-1") != null && "Club".equals(item.selectFirst("th.column-1").text())) {
if ((item.selectFirst("th.column-1") != null && "Club".equals(item.selectFirst("th.column-1").text()))
|| item.selectFirst("td.column-1") == null) {
continue;
}
String team = item.selectFirst("td.column-1").text();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,38 @@

public class InjuredSuspendedMaLigue2ClientTest extends AbstractMockTestClient {

@Test
public void testCheckTeams2023L2() throws Exception {
// TODO when official
}

@Test
public void testSeasons2023() throws Exception {
InjuredSuspendedMaLigue2Client client = spy(InjuredSuspendedMaLigue2Client.build(null));
doReturn(
FileUtils.readFileToString(new File(TESTFILES_BASE, "maligue2.joueurs-blesses-et-suspendus.20230802.html"), Charset.forName("UTF-8")))
.when(client).getHtmlContent();

// Assert.assertNotNull("City Player Type", client.getPlayer("Player", "City"));
// Assert.assertEquals("City Player Type", OutType.INJURY_RED, client.getPlayer("Player", "City").getOutType());

Assert.assertNotNull("SC Bastia Guidi Blesse", client.getPlayer("Guidi", "Bastia"));
Assert.assertEquals("SC Bastia Guidi Blesse", OutType.INJURY_RED, client.getPlayer("Guidi", "Bastia").getOutType());

// Blesse
// SM Caen Ben Youssef
// USL Dunkerque Gnanduillet
// EA Guingamp Vallier
// Stade Lavallois Ferhaoui

// Suspendus
// Grenoble Foot Mendy (J1)
// Pau FC Batisse (J1)
// Pau FC Abzi (J1)
// Pau FC D'Almeida (J1)

}

@Test
public void testCheckTeams2022L2() throws Exception {
List<String> mpgTeams = Arrays.asList("Amiens", "Annecy", "Bastia", "Bordeaux", "Caen", "Dijon", "Grenoble", "Guingamp", "Laval", "Le Havre",
Expand All @@ -50,7 +82,7 @@ public void testCheckTeams2022L2() throws Exception {
}

@Test
public void testReasons2022() throws Exception {
public void testSeasons2022() throws Exception {
InjuredSuspendedMaLigue2Client client = spy(InjuredSuspendedMaLigue2Client.build(null));
doReturn(
FileUtils.readFileToString(new File(TESTFILES_BASE, "maligue2.joueurs-blesses-et-suspendus.20220724.html"), Charset.forName("UTF-8")))
Expand Down Expand Up @@ -105,7 +137,7 @@ public void testCheckTeams2021L2() throws Exception {
}

@Test
public void testReasons2021() throws Exception {
public void testSeasons2021() throws Exception {
InjuredSuspendedMaLigue2Client client = spy(InjuredSuspendedMaLigue2Client.build(null));
doReturn(
FileUtils.readFileToString(new File(TESTFILES_BASE, "maligue2.joueurs-blesses-et-suspendus.20210804.html"), Charset.forName("UTF-8")))
Expand Down
Loading

0 comments on commit b81bb51

Please sign in to comment.