From 59571d0a03b5dee9b1d589ed899d684eef08a1b0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 20:51:59 +0000 Subject: [PATCH 1/3] Bump jsoup from 1.13.1 to 1.14.2 in /Mage.Client Bumps [jsoup](https://github.com/jhy/jsoup) from 1.13.1 to 1.14.2. - [Release notes](https://github.com/jhy/jsoup/releases) - [Changelog](https://github.com/jhy/jsoup/blob/master/CHANGES) - [Commits](https://github.com/jhy/jsoup/compare/jsoup-1.13.1...jsoup-1.14.2) --- updated-dependencies: - dependency-name: org.jsoup:jsoup dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Mage.Client/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mage.Client/pom.xml b/Mage.Client/pom.xml index fc3c45e7172..79867c89069 100644 --- a/Mage.Client/pom.xml +++ b/Mage.Client/pom.xml @@ -110,7 +110,7 @@ org.jsoup jsoup - 1.13.1 + 1.14.2 truevfs-profile-base From d481172eb4ce193e84156a88339dfdddb2865af9 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Fri, 27 Aug 2021 20:51:27 +0400 Subject: [PATCH 2/3] Code: added test coverage reports by JaCoCo lib (generate by command like "mvn install -Djacoco.skip=false"); Code: added test coverage support for Sonar reports; --- .gitignore | 1 + Mage.Tests/pom.xml | 3 --- Mage.Verify/pom.xml | 3 --- pom.xml | 52 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 403ce01bda1..fa8fced8097 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ Mage.Client/target Mage.Common/target # Mage.Plugins +Mage.Plugins/target Mage.Plugins/Mage.Card.Plugin/target Mage.Plugins/Mage.Counter.Plugin/target Mage.Plugins/Mage.Theme.Plugin/target diff --git a/Mage.Tests/pom.xml b/Mage.Tests/pom.xml index c0f30839981..55f495d7659 100644 --- a/Mage.Tests/pom.xml +++ b/Mage.Tests/pom.xml @@ -81,9 +81,6 @@ org.apache.maven.plugins maven-surefire-plugin - - -Dfile.encoding=UTF-8 - org.apache.maven.plugins diff --git a/Mage.Verify/pom.xml b/Mage.Verify/pom.xml index fdab7c4bd97..91263f642d1 100644 --- a/Mage.Verify/pom.xml +++ b/Mage.Verify/pom.xml @@ -64,9 +64,6 @@ org.apache.maven.plugins maven-surefire-plugin - - -Dfile.encoding=UTF-8 - org.apache.maven.plugins diff --git a/pom.xml b/pom.xml index 7e1335d59cd..91c1340a6ce 100644 --- a/pom.xml +++ b/pom.xml @@ -51,16 +51,52 @@ + + + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + + + + prepare-agent + + + + + generate-code-coverage-report + verify + + report + + + + + report-aggregate + verify + + report-aggregate + + + + + org.apache.maven.plugins maven-surefire-plugin 2.22.2 + @@ -99,8 +135,24 @@ 1.4.49 + -Dfile.encoding=UTF-8 UTF-8 yyyy-MM-dd'T'HH:mm:ss'Z' + + + true + + + Mage.Verify/target/site/jacoco-aggregate/jacoco.xml + ${project.basedir}/../${aggregate.report.dir} From 91d577b0afad07b76bb8081d3be2e5d18894bc2c Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Fri, 27 Aug 2021 21:42:25 +0400 Subject: [PATCH 3/3] Test framework: fixed that ai play step command doesn't work correctly on declare attackers and blockers steps; --- .../cards/single/stx/DaemogothTitanTest.java | 47 +++++++++++++++++++ .../java/org/mage/test/player/TestPlayer.java | 8 ++-- 2 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/stx/DaemogothTitanTest.java diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/stx/DaemogothTitanTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/stx/DaemogothTitanTest.java new file mode 100644 index 00000000000..3c1c9209d0d --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/stx/DaemogothTitanTest.java @@ -0,0 +1,47 @@ +package org.mage.test.cards.single.stx; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBaseWithAIHelps; + +/** + * @author JayDi85 + */ +public class DaemogothTitanTest extends CardTestPlayerBaseWithAIHelps { + + @Test + public void test_Attack_Manual() { + // Whenever Daemogoth Titan attacks or blocks, sacrifice a creature. + addCard(Zone.BATTLEFIELD, playerA, "Daemogoth Titan"); // 11/10 + addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1); + + attack(1, playerA, "Daemogoth Titan"); + addTarget(playerA, "Grizzly Bears"); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertLife(playerB, 20 - 11); + assertGraveyardCount(playerA, "Grizzly Bears", 1); + } + + @Test + public void test_Attack_AI() { + // Whenever Daemogoth Titan attacks or blocks, sacrifice a creature. + addCard(Zone.BATTLEFIELD, playerA, "Daemogoth Titan"); // 11/10 + addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1); + + aiPlayStep(1, PhaseStep.DECLARE_ATTACKERS, playerA); + + setStrictChooseMode(true); + setStopAt(1, PhaseStep.END_TURN); + execute(); + assertAllCommandsUsed(); + + assertLife(playerB, 20 - 11); + assertGraveyardCount(playerA, "Grizzly Bears", 1); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index a4e77c9a2ab..cd6def1ac98 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -1683,8 +1683,8 @@ public class TestPlayer implements Player { mustAttackByAction = true; madeAttackByAction = true; this.computerPlayer.selectAttackers(game, attackingPlayerId); - it.remove(); - break; + // play step action will be removed on step end + continue; } if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("attack:")) { @@ -1774,8 +1774,8 @@ public class TestPlayer implements Player { if (action.getTurnNum() == game.getTurnNum() && action.getAction().equals(AI_PREFIX + AI_COMMAND_PLAY_STEP)) { mustBlockByAction = true; this.computerPlayer.selectBlockers(source, game, defendingPlayerId); - actions.remove(action); - break; + // play step action will be removed on step end + continue; } if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("block:")) {