diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dc7bdeb --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* \ No newline at end of file diff --git a/pom.xml b/pom.xml index af721d2..e091ca9 100644 --- a/pom.xml +++ b/pom.xml @@ -8,18 +8,22 @@ MTCG 1.0-SNAPSHOT - - junit - junit - RELEASE - test - org.junit.jupiter junit-jupiter RELEASE test + + org.mockito + mockito-core + 3.5.13 + + + org.mockito + mockito-junit-jupiter + 3.5.13 + diff --git a/src/test/java/CardTest.java b/src/test/java/CardTest.java index 2aedfe5..2a17ca6 100644 --- a/src/test/java/CardTest.java +++ b/src/test/java/CardTest.java @@ -1,9 +1,6 @@ -import org.junit.Test; +import org.junit.jupiter.api.Test; - - - -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertTrue; public class CardTest { diff --git a/src/test/java/CardsTest.java b/src/test/java/CardsTest.java index eb40f8c..0ab708b 100644 --- a/src/test/java/CardsTest.java +++ b/src/test/java/CardsTest.java @@ -1,8 +1,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; import java.util.ArrayList; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class CardsTest { public Card newCard, card; public Cards cards; diff --git a/src/test/java/CoinsTest.java b/src/test/java/CoinsTest.java index 580f423..56bd270 100644 --- a/src/test/java/CoinsTest.java +++ b/src/test/java/CoinsTest.java @@ -1,19 +1,15 @@ -import static org.hamcrest.CoreMatchers.allOf; -import static org.hamcrest.CoreMatchers.anyOf; -import static org.hamcrest.CoreMatchers.hasItems; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.*; - -import org.junit.Test; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assertions.assertFalse; public class CoinsTest { @Test public void test_getCoinAmount(){ Coins coin = new Coins(10); - assertTrue("Fehler getCoinAmmount ist negativ",coin.getCoinAmount() >= 0); + assertTrue(coin.getCoinAmount() >= 0); } @Test @@ -23,7 +19,7 @@ public class CoinsTest { coin.addCoin(-10); fail("Erwartet NegativAmountException - addCoin"); }catch (NegativAmountException negativAmountException) { - assertThat(negativAmountException.getMessage(), is("negativAmountException")); + assertTrue(negativAmountException.getMessage()=="negativAmountException"); } } @@ -34,7 +30,7 @@ public class CoinsTest { coin.removeCoin(-10); fail("Erwartet NegativAmountException - removeCoin"); }catch (NegativAmountException negativAmountException) { - assertThat(negativAmountException.getMessage(), is("negativAmountException")); + assertTrue(negativAmountException.getMessage()=="negativAmountException"); } } diff --git a/src/test/java/PackageTest.java b/src/test/java/PackageTest.java index 9d8fb99..f117be2 100644 --- a/src/test/java/PackageTest.java +++ b/src/test/java/PackageTest.java @@ -3,7 +3,8 @@ import org.junit.jupiter.api.Test; import java.util.ArrayList; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class PackageTest { private Cards newCards, cards, nochNewCards; diff --git a/src/test/java/SimpleCardTest.java b/src/test/java/SimpleCardTest.java new file mode 100644 index 0000000..602bf5b --- /dev/null +++ b/src/test/java/SimpleCardTest.java @@ -0,0 +1,18 @@ +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import static org.mockito.Mockito.mock; + +public class SimpleCardTest { + + @Test + @DisplayName("Test - getName()") + public void test_getName(){ + //arrange + Card mockedA = mock(Card.class); //Erstellt einen Mock + String name = "Neuer Name"; + //act + + //assert + } +} diff --git a/src/test/java/StackTest.java b/src/test/java/StackTest.java index 0b8a4b5..dfc491c 100644 --- a/src/test/java/StackTest.java +++ b/src/test/java/StackTest.java @@ -3,7 +3,8 @@ import org.junit.jupiter.api.Test; import java.util.ArrayList; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class StackTest { private Cards newCards, cards, nochNewCards; diff --git a/src/test/java/StoreTest.java b/src/test/java/StoreTest.java index cc82604..24a6c9e 100644 --- a/src/test/java/StoreTest.java +++ b/src/test/java/StoreTest.java @@ -3,7 +3,7 @@ import org.junit.jupiter.api.Test; import java.util.ArrayList; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; public class StoreTest { diff --git a/src/test/java/TradingDealTest.java b/src/test/java/TradingDealTest.java index 3d32afb..a1bfffc 100644 --- a/src/test/java/TradingDealTest.java +++ b/src/test/java/TradingDealTest.java @@ -3,7 +3,8 @@ import org.junit.jupiter.api.Test; import java.util.ArrayList; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class TradingDealTest { diff --git a/src/test/java/UserTest.java b/src/test/java/UserTest.java index 2dcef10..b066a91 100644 --- a/src/test/java/UserTest.java +++ b/src/test/java/UserTest.java @@ -1,9 +1,10 @@ -import org.junit.Test; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.ArrayList; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class UserTest { private TradingDeal tradingDeal;