From 64ea60cebc5cfd28b93838f0162b12e2c9c88256 Mon Sep 17 00:00:00 2001 From: Alix Lourme Date: Sat, 21 Aug 2021 14:10:34 +0200 Subject: [PATCH] Testing OutType for MaLigue2 --- .../InjuredSuspendedMaLigue2ClientTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/java/org/blondin/mpg/out/InjuredSuspendedMaLigue2ClientTest.java b/src/test/java/org/blondin/mpg/out/InjuredSuspendedMaLigue2ClientTest.java index 59dd728..8211835 100644 --- a/src/test/java/org/blondin/mpg/out/InjuredSuspendedMaLigue2ClientTest.java +++ b/src/test/java/org/blondin/mpg/out/InjuredSuspendedMaLigue2ClientTest.java @@ -15,6 +15,7 @@ import org.apache.commons.io.FileUtils; import org.blondin.mpg.AbstractMockTestClient; import org.blondin.mpg.config.Config; +import org.blondin.mpg.out.model.OutType; import org.blondin.mpg.out.model.Player; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; @@ -48,6 +49,23 @@ public void testCheckTeams2021L2() throws Exception { } } + @Test + public void testReasons() 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"))) + .when(client).getHtmlContent(); + + Assert.assertNotNull("Absent : Diallo (JO) / AC Ajaccio", client.getPlayer("Diallo", "Ajaccio")); + Assert.assertEquals("Absent : Diallo (JO) / AC Ajaccio", OutType.ASBENT, client.getPlayer("Diallo", "Ajaccio").getOutType()); + Assert.assertNotNull("Absent : Gioacchini (Gold Cup) / SM Caen", client.getPlayer("Gioacchini", "Caen")); + Assert.assertEquals("Absent : Gioacchini (Gold Cup) / SM Caen", OutType.ASBENT, client.getPlayer("Gioacchini", "Caen").getOutType()); + Assert.assertNotNull("Injuries : Vandermersch / SM Caen", client.getPlayer("Vandermersch", "Caen")); + Assert.assertEquals("Injuries : Vandermersch / SM Caen", OutType.INJURY_RED, client.getPlayer("Vandermersch", "Caen").getOutType()); + Assert.assertNotNull("Suspended : Traoré (J3) / Dijon FCO", client.getPlayer("Traore", "Dijon")); + Assert.assertEquals("Suspended : Traoré (J3) / Dijon FCO", OutType.SUSPENDED, client.getPlayer("Traore", "Dijon").getOutType()); + } + @Test public void testInjuriesSameName() throws Exception { InjuredSuspendedMaLigue2Client client = spy(InjuredSuspendedMaLigue2Client.build(null));