// Path: src/test/java/com/nosoftskills/predcomposer/alternatives/PredictionsServiceAlternative.java
// @Alternative
// public class PredictionsServiceAlternative extends PredictionsService {
// 
//     private static Set<Prediction> ivansPredictions = new HashSet<>();
//     private static Set<Prediction> kokosPredictions = new HashSet<>();
// 
//     private static Set<Prediction> game3Predictions = new HashSet<>();
//     private static Set<Prediction> game2Predictions = new HashSet<>();
// 
//     static {
//         ivansPredictions.addAll(Arrays.asList(prediction1, prediction3));
//         kokosPredictions.add(prediction2);
// 
//         game2Predictions.addAll(Arrays.asList(prediction1, prediction2));
//         game3Predictions.add(prediction3);
//     }
// 
//     @Override
//     public Set<Prediction> getPredictionsForUser(User user) {
//         switch (user.getUserName()) {
//         case "ivan":
//             return ivansPredictions;
//         case "koko":
//             return kokosPredictions;
//         default:
//             return null;
//         }
//     }
// 
//     @Override
//     public Set<Prediction> getPredictionsForGame(Game game) {
//         if (game.equals(game1)) {
//             return game3Predictions;
//         } else if (game.equals(game2)) {
//             return game2Predictions;
//         } else {
//             return null;
//         }
//     }
// }
// 
// Path: src/test/java/com/nosoftskills/predcomposer/alternatives/UserContextAlternative.java
// @Alternative
// @SessionScoped
// public class UserContextAlternative extends UserContext {
// 
//     @Override
//     public User getLoggedUser() {
//         return user1;
//     }
// 
// }
// 
// Path: src/test/java/com/nosoftskills/predcomposer/common/TestData.java
// public static Game game2;


import com.nosoftskills.predcomposer.alternatives.PredictionsServiceAlternative;
import com.nosoftskills.predcomposer.alternatives.UserContextAlternative;
import org.jglue.cdiunit.ActivatedAlternatives;
import org.jglue.cdiunit.CdiRunner;
import org.jglue.cdiunit.InRequestScope;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import static com.nosoftskills.predcomposer.common.TestData.game2;
import static org.junit.Assert.assertEquals;
package com.nosoftskills.predcomposer.prediction;





/**
 * @author Ivan St. Ivanov
 */
@RunWith(CdiRunner.class)
@ActivatedAlternatives({
        PredictionsServiceAlternative.class, UserContextAlternative.class
})
public class ViewGamePredictionsBeanTest {

    @Inject
    private ViewGamePredictionsBean bean;

    @Test
    @InRequestScope
    public void shouldLoadGamePredictionsUponRequest() throws Exception {
        bean.showGamePredictions(game2);
// Path: src/test/java/com/nosoftskills/predcomposer/alternatives/PredictionsServiceAlternative.java
// @Alternative
// public class PredictionsServiceAlternative extends PredictionsService {
// 
//     private static Set<Prediction> ivansPredictions = new HashSet<>();
//     private static Set<Prediction> kokosPredictions = new HashSet<>();
// 
//     private static Set<Prediction> game3Predictions = new HashSet<>();
//     private static Set<Prediction> game2Predictions = new HashSet<>();
// 
//     static {
//         ivansPredictions.addAll(Arrays.asList(prediction1, prediction3));
//         kokosPredictions.add(prediction2);
// 
//         game2Predictions.addAll(Arrays.asList(prediction1, prediction2));
//         game3Predictions.add(prediction3);
//     }
// 
//     @Override
//     public Set<Prediction> getPredictionsForUser(User user) {
//         switch (user.getUserName()) {
//         case "ivan":
//             return ivansPredictions;
//         case "koko":
//             return kokosPredictions;
//         default:
//             return null;
//         }
//     }
// 
//     @Override
//     public Set<Prediction> getPredictionsForGame(Game game) {
//         if (game.equals(game1)) {
//             return game3Predictions;
//         } else if (game.equals(game2)) {
//             return game2Predictions;
//         } else {
//             return null;
//         }
//     }
// }
// 
// Path: src/test/java/com/nosoftskills/predcomposer/alternatives/UserContextAlternative.java
// @Alternative
// @SessionScoped
// public class UserContextAlternative extends UserContext {
// 
//     @Override
//     public User getLoggedUser() {
//         return user1;
//     }
// 
// }
// 
// Path: src/test/java/com/nosoftskills/predcomposer/common/TestData.java
// public static Game game2;


// Path: src/test/java/com/nosoftskills/predcomposer/prediction/ViewGamePredictionsBeanTest.java
import com.nosoftskills.predcomposer.alternatives.PredictionsServiceAlternative;
import com.nosoftskills.predcomposer.alternatives.UserContextAlternative;
import org.jglue.cdiunit.ActivatedAlternatives;
import org.jglue.cdiunit.CdiRunner;
import org.jglue.cdiunit.InRequestScope;
import org.junit.Test;
import org.junit.runner.RunWith;
import javax.inject.Inject;
import static com.nosoftskills.predcomposer.common.TestData.game2;
import static org.junit.Assert.assertEquals;

package com.nosoftskills.predcomposer.prediction;





/**
 * @author Ivan St. Ivanov
 */
@RunWith(CdiRunner.class)
@ActivatedAlternatives({
        PredictionsServiceAlternative.class, UserContextAlternative.class
})
public class ViewGamePredictionsBeanTest {

    @Inject
    private ViewGamePredictionsBean bean;

    @Test
    @InRequestScope
    public void shouldLoadGamePredictionsUponRequest() throws Exception {
        bean.showGamePredictions(game2);
        assertEquals(game2, bean.getGame());