Fixed JUnits

This commit is contained in:
marcin.sciesinski
2018-04-16 13:05:51 -07:00
parent caa6753ac6
commit b7c7fa98e3
4 changed files with 13 additions and 53 deletions

View File

@@ -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<SoloDraft.DraftChoice> 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<SoloDraft.DraftChoice> 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());
}
}

View File

@@ -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<LeagueSerieData> series = leagueData.getSeries();
assertTrue(series.size() == 3);
assertTrue(series.get(0).getStart() == 20120312);

View File

@@ -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");

View File

@@ -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<Player, CardCollection>());
@@ -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<Player, CardCollection>());
@@ -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<Player, CardCollection>());