From b7c7fa98e31b22b5761c6d8afa271811175b4afc Mon Sep 17 00:00:00 2001 From: "marcin.sciesinski" Date: Mon, 16 Apr 2018 13:05:51 -0700 Subject: [PATCH] Fixed JUnits --- .../draft2/SoloDraftDefinitionsTest.java | 34 ------------------- .../league/ConstructedLeagueDataTest.java | 4 +-- .../lotro/league/LeagueServiceTest.java | 14 ++++---- .../lotro/league/SealedLeagueDataTest.java | 14 ++++---- 4 files changed, 13 insertions(+), 53 deletions(-) delete mode 100644 gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/draft2/SoloDraftDefinitionsTest.java diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/draft2/SoloDraftDefinitionsTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/draft2/SoloDraftDefinitionsTest.java deleted file mode 100644 index 485ed4db6..000000000 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/draft2/SoloDraftDefinitionsTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.gempukku.lotro.draft2; - -import com.gempukku.lotro.game.CardCollection; -import org.junit.Test; - -import static org.junit.Assert.*; - -public class SoloDraftDefinitionsTest { - @Test - public void loadSoloDraftDefinitions() { - SoloDraftDefinitions soloDraftDefinitions = new SoloDraftDefinitions(null, null, null, null); - } - - @Test - public void playerDrafting() { - SoloDraftDefinitions soloDraftDefinitions = new SoloDraftDefinitions(null, null, null, null); - SoloDraft soloDraft = soloDraftDefinitions.getSoloDraft("hobbit_draft"); - assertTrue(soloDraft.hasNextStage(0, 0)); - Iterable availableChoices = soloDraft.getAvailableChoices(0, 0); - String choiceId = availableChoices.iterator().next().getChoiceId(); - - CardCollection firstPickCards = soloDraft.getCardsForChoiceId(choiceId, 0, 0); - assertFalse(firstPickCards.getAll().isEmpty()); - - assertTrue(soloDraft.getCardsForChoiceId("madeUpChoiceId", 0, 0).getAll().isEmpty()); - - assertTrue(soloDraft.hasNextStage(0, 1)); - Iterable secondChoices = soloDraft.getAvailableChoices(0, 1); - String secondChoiceId = secondChoices.iterator().next().getChoiceId(); - - assertFalse(soloDraft.getCardsForChoiceId(secondChoiceId, 0, 1).getAll().isEmpty()); - assertTrue(soloDraft.getCardsForChoiceId("madeUpChoiceId", 0, 1).getAll().isEmpty()); - } -} \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/ConstructedLeagueDataTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/ConstructedLeagueDataTest.java index b075714a3..2e6bc2928 100644 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/ConstructedLeagueDataTest.java +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/ConstructedLeagueDataTest.java @@ -10,11 +10,9 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; public class ConstructedLeagueDataTest { - private SoloDraftDefinitions soloDraftDefinitions = new SoloDraftDefinitions(null, null, null, null); - @Test public void testParameters() { - ConstructedLeagueData leagueData = new ConstructedLeagueData(new CardSets(), soloDraftDefinitions, "20120312,fotr_block,0.7,default,All cards,7,10,3,fotr1_block,fotr_block,fotr2_block,fotr_block,fotr_block,fotr_block"); + ConstructedLeagueData leagueData = new ConstructedLeagueData(new CardSets(), null, "20120312,fotr_block,0.7,default,All cards,7,10,3,fotr1_block,fotr_block,fotr2_block,fotr_block,fotr_block,fotr_block"); final List series = leagueData.getSeries(); assertTrue(series.size() == 3); assertTrue(series.get(0).getStart() == 20120312); diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/LeagueServiceTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/LeagueServiceTest.java index d22d120e2..2f6386768 100644 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/LeagueServiceTest.java +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/LeagueServiceTest.java @@ -8,7 +8,6 @@ import com.gempukku.lotro.db.LeagueMatchDAO; import com.gempukku.lotro.db.LeagueParticipationDAO; import com.gempukku.lotro.db.vo.League; import com.gempukku.lotro.db.vo.LeagueMatchResult; -import com.gempukku.lotro.draft2.SoloDraftDefinitions; import org.junit.Test; import org.mockito.Mockito; @@ -20,7 +19,6 @@ import java.util.Set; import static org.junit.Assert.*; public class LeagueServiceTest { - private SoloDraftDefinitions soloDraftDefinitions = new SoloDraftDefinitions(null, null, null, null); private CardSets _cardSets = new CardSets(); @Test public void testJoiningLeagueAfterMaxGamesPlayed() throws Exception { @@ -37,7 +35,7 @@ public class LeagueServiceTest { League league = new League(5000, "League name", "leagueType", NewConstructedLeagueData.class.getName(), sb.toString(), 0); leagues.add(league); - LeagueSerieData leagueSerie = league.getLeagueData(_cardSets, soloDraftDefinitions).getSeries().get(0); + LeagueSerieData leagueSerie = league.getLeagueData(_cardSets, null).getSeries().get(0); Mockito.when(leagueDao.loadActiveLeagues(Mockito.anyInt())).thenReturn(leagues); @@ -50,7 +48,7 @@ public class LeagueServiceTest { LeagueParticipationDAO leagueParticipationDAO = Mockito.mock(LeagueParticipationDAO.class); CollectionsManager collectionsManager = Mockito.mock(CollectionsManager.class); - LeagueService leagueService = new LeagueService(leagueDao, leagueMatchDAO, leagueParticipationDAO, collectionsManager, _cardSets, soloDraftDefinitions); + LeagueService leagueService = new LeagueService(leagueDao, leagueMatchDAO, leagueParticipationDAO, collectionsManager, _cardSets, null); assertTrue(leagueService.canPlayRankedGame(league, leagueSerie, "player1")); assertTrue(leagueService.canPlayRankedGameAgainst(league, leagueSerie, "player1", "player2")); @@ -90,7 +88,7 @@ public class LeagueServiceTest { League league = new League(5000, "League name", "leagueType", NewConstructedLeagueData.class.getName(), sb.toString(), 0); leagues.add(league); - LeagueSerieData leagueSerie = league.getLeagueData(_cardSets, soloDraftDefinitions).getSeries().get(0); + LeagueSerieData leagueSerie = league.getLeagueData(_cardSets, null).getSeries().get(0); Mockito.when(leagueDao.loadActiveLeagues(Mockito.anyInt())).thenReturn(leagues); @@ -104,7 +102,7 @@ public class LeagueServiceTest { LeagueParticipationDAO leagueParticipationDAO = Mockito.mock(LeagueParticipationDAO.class); CollectionsManager collectionsManager = Mockito.mock(CollectionsManager.class); - LeagueService leagueService = new LeagueService(leagueDao, leagueMatchDAO, leagueParticipationDAO, collectionsManager, _cardSets, soloDraftDefinitions); + LeagueService leagueService = new LeagueService(leagueDao, leagueMatchDAO, leagueParticipationDAO, collectionsManager, _cardSets, null); assertTrue(leagueService.canPlayRankedGame(league, leagueSerie, "player1")); assertFalse(leagueService.canPlayRankedGameAgainst(league, leagueSerie, "player1", "player2")); @@ -136,7 +134,7 @@ public class LeagueServiceTest { League league = new League(5000, "League name", "leagueType", NewConstructedLeagueData.class.getName(), sb.toString(), 0); leagues.add(league); - LeagueSerieData leagueSerie = league.getLeagueData(_cardSets, soloDraftDefinitions).getSeries().get(0); + LeagueSerieData leagueSerie = league.getLeagueData(_cardSets, null).getSeries().get(0); Mockito.when(leagueDao.loadActiveLeagues(Mockito.anyInt())).thenReturn(leagues); @@ -154,7 +152,7 @@ public class LeagueServiceTest { Mockito.when(leagueParticipationDAO.getUsersParticipating(league.getType())).thenReturn(players); CollectionsManager collectionsManager = Mockito.mock(CollectionsManager.class); - LeagueService leagueService = new LeagueService(leagueDao, leagueMatchDAO, leagueParticipationDAO, collectionsManager, _cardSets, soloDraftDefinitions); + LeagueService leagueService = new LeagueService(leagueDao, leagueMatchDAO, leagueParticipationDAO, collectionsManager, _cardSets, null); leagueService.reportLeagueGameResult(league, leagueSerie, "player1", "player2"); leagueService.reportLeagueGameResult(league, leagueSerie, "player1", "player3"); diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/SealedLeagueDataTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/SealedLeagueDataTest.java index 71101ea1d..4617f8856 100644 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/SealedLeagueDataTest.java +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/league/SealedLeagueDataTest.java @@ -3,7 +3,6 @@ package com.gempukku.lotro.league; import com.gempukku.lotro.cards.CardSets; import com.gempukku.lotro.collection.CollectionsManager; import com.gempukku.lotro.db.vo.CollectionType; -import com.gempukku.lotro.draft2.SoloDraftDefinitions; import com.gempukku.lotro.game.CardCollection; import com.gempukku.lotro.game.DefaultCardCollection; import com.gempukku.lotro.game.Player; @@ -19,11 +18,10 @@ import java.util.*; import static org.junit.Assert.assertEquals; public class SealedLeagueDataTest { - private SoloDraftDefinitions soloDraftDefinitions = new SoloDraftDefinitions(null, null, null, null); @Test public void testJoinLeagueFirstWeek() { - SealedLeagueData data = new SealedLeagueData(new CardSets(), soloDraftDefinitions, "fotr_block,20120101,test,Test Collection"); + SealedLeagueData data = new SealedLeagueData(new CardSets(), null, "fotr_block,20120101,test,Test Collection"); CollectionType collectionType = new CollectionType("test", "Test Collection"); for (int i = 20120101; i < 20120108; i++) { CollectionsManager collectionsManager = Mockito.mock(CollectionsManager.class); @@ -58,7 +56,7 @@ public class SealedLeagueDataTest { @Test public void testJoinLeagueSecondWeek() { - SealedLeagueData data = new SealedLeagueData(new CardSets(), soloDraftDefinitions, "fotr_block,20120101,test,Test Collection"); + SealedLeagueData data = new SealedLeagueData(new CardSets(), null, "fotr_block,20120101,test,Test Collection"); CollectionType collectionType = new CollectionType("test", "Test Collection"); for (int i = 20120108; i < 20120115; i++) { CollectionsManager collectionsManager = Mockito.mock(CollectionsManager.class); @@ -99,7 +97,7 @@ public class SealedLeagueDataTest { @Test public void testSwitchToFirstWeek() { - SealedLeagueData data = new SealedLeagueData(new CardSets(), soloDraftDefinitions, "fotr_block,20120101,test,Test Collection"); + SealedLeagueData data = new SealedLeagueData(new CardSets(), null, "fotr_block,20120101,test,Test Collection"); for (int i = 20120101; i < 20120108; i++) { CollectionsManager collectionsManager = Mockito.mock(CollectionsManager.class); Mockito.when(collectionsManager.getPlayersCollection("test")).thenReturn(new HashMap()); @@ -112,7 +110,7 @@ public class SealedLeagueDataTest { @Test public void testProcessMidFirstWeek() { - SealedLeagueData data = new SealedLeagueData(new CardSets(), soloDraftDefinitions, "fotr_block,20120101,test,Test Collection"); + SealedLeagueData data = new SealedLeagueData(new CardSets(), null, "fotr_block,20120101,test,Test Collection"); for (int i = 20120101; i < 20120108; i++) { CollectionsManager collectionsManager = Mockito.mock(CollectionsManager.class); Mockito.when(collectionsManager.getPlayersCollection("test")).thenReturn(new HashMap()); @@ -124,7 +122,7 @@ public class SealedLeagueDataTest { @Test public void testSwitchToSecondWeek() { - SealedLeagueData data = new SealedLeagueData(new CardSets(), soloDraftDefinitions, "fotr_block,20120101,test,Test Collection"); + SealedLeagueData data = new SealedLeagueData(new CardSets(), null, "fotr_block,20120101,test,Test Collection"); CollectionType collectionType = new CollectionType("test", "Test Collection"); for (int i = 20120108; i < 20120115; i++) { CollectionsManager collectionsManager = Mockito.mock(CollectionsManager.class); @@ -160,7 +158,7 @@ public class SealedLeagueDataTest { @Test public void testProcessMidSecondWeek() { - SealedLeagueData data = new SealedLeagueData(new CardSets(), soloDraftDefinitions, "fotr_block,20120101,test,Test Collection"); + SealedLeagueData data = new SealedLeagueData(new CardSets(), null, "fotr_block,20120101,test,Test Collection"); for (int i = 20120108; i < 20120115; i++) { CollectionsManager collectionsManager = Mockito.mock(CollectionsManager.class); Mockito.when(collectionsManager.getPlayersCollection("test")).thenReturn(new HashMap());