// Path: tanaguru-survey-api/src/main/java/org/opens/tanaguru/survey/exception/ForbiddenUserException.java
// public class ForbiddenUserException extends RuntimeException{
// 
//     private String parameter = null;
//     public String getParameter() {
//         return parameter;
//     }
// 
//     public void setParameter(String parameter) {
//         this.parameter = parameter;
//     }
// 
//     private static final String FORBIDDEN_USER_EXCEPTION_MSG_KEY = "forbidden-user-exception-msg-key";
//     private static final String NULL_USER_EXCEPTION_MSG_KEY = "null-user-exception-msg-key";
// 
//     public String getExceptionMsgKey() {
//         if (parameter != null) {
//             return FORBIDDEN_USER_EXCEPTION_MSG_KEY;
//         }
//         return NULL_USER_EXCEPTION_MSG_KEY;
//     }
// 
//     private static final long serialVersionUID = 6868141361082941720L;
// 
//     public ForbiddenUserException(String parameter) {
//         this.parameter = parameter;
//     }
// 
//     public ForbiddenUserException() {}
// 
// }
// 
// Path: tanaguru-survey-impl/src/test/java/org/opens/tanaguru/survey/test/util/DecoratorFactory.java
// public final class DecoratorFactory {
// 
//     public static UserDataServiceDecorator getUserDataServiceDecorator() {
//         UserDataServiceDecoratorImpl udsd =
//                 new UserDataServiceDecoratorImpl(new UserDataServiceMock());
//         udsd.setEntityDao(new UserDAOMock());
//         return udsd;
//     }
// 
//     public static ContractDataServiceDecorator getContractDataServiceDecorator() {
//         ContractDataServiceDecoratorImpl cdsd =
//                 new ContractDataServiceDecoratorImpl(new ContractDataServiceMock());
//         cdsd.setEntityDao(new ContractDAOMock());
//         return cdsd;
//     }
//     
// }
// 
// Path: tanaguru-survey-api/src/main/java/org/opens/tanaguru/survey/view/data/SynthesisData.java
// public interface SynthesisData {
// 
//     /**
//      *
//      * @return
//      */
//     int getTotalNumberOfMonitoredSite();
// 
//     /**
//      * 
//      * @param totalNumberOfMonitoredSite
//      */
//     void setTotalNumberOfMonitoredSite(int totalNumberOfMonitoredSite);
// 
//     /**
//      *
//      * @return
//      */
//     Collection<DetailedSurveyList> getSpotlightSurveyList();
// 
//     /**
//      *
//      * @param spotlightSurveyList
//      */
//     void setSpotlightSurveyList(Collection<DetailedSurveyList> spotlightSurveyList);
// 
// }


import org.opens.tanaguru.survey.exception.ForbiddenUserException;
import org.opens.tanaguru.survey.test.util.DecoratorFactory;
import org.opens.tanaguru.survey.view.data.SynthesisData;
import junit.framework.TestCase;
/*
 * Tanaguru - Automated webpage assessment
 * Copyright (C) 2008-2011  Open-S Company
 *
 * This file is part of Tanaguru.
 *
 * Tanaguru is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Contact us by mail: open-s AT open-s DOT com
 */
package org.opens.tanaguru.survey.view.data.factory;


/**
 *
 * @author jkowalczyk
 */
public class SynthesisDataFactoryImplTest extends TestCase {
    
    public SynthesisDataFactoryImplTest(String testName) {
        super(testName);
    }

    public void testCreateContractResult() {
        SynthesisDataFactoryImpl sdfi = new SynthesisDataFactoryImpl();
        sdfi.setContractDataServiceDecorator(DecoratorFactory.getContractDataServiceDecorator());
        sdfi.setUserDataServiceDecorator(DecoratorFactory.getUserDataServiceDecorator());
        sdfi.setDetailedSurveyListFactory(DetailedSurveyListFactoryImplTest.getInitialisedSurveyListFactory(null));
        sdfi.setSpotlightList(null);
        sdfi.setUserListPrefix("mock-label");
        SynthesisData idp = sdfi.createSynthesisData();
        assertEquals(4, idp.getTotalNumberOfMonitoredSite());
        assertTrue(idp.getSpotlightSurveyList().isEmpty());
        sdfi.setUserListPrefix(null);
        idp = sdfi.createSynthesisData();
        assertEquals(4, idp.getTotalNumberOfMonitoredSite());
        sdfi.setUserListPrefix("other-label");
        idp = sdfi.createSynthesisData();
        assertEquals(0, idp.getTotalNumberOfMonitoredSite());
        sdfi.setSpotlightList("user1@tanaguru.org");
        idp = sdfi.createSynthesisData();
// Path: tanaguru-survey-api/src/main/java/org/opens/tanaguru/survey/exception/ForbiddenUserException.java
// public class ForbiddenUserException extends RuntimeException{
// 
//     private String parameter = null;
//     public String getParameter() {
//         return parameter;
//     }
// 
//     public void setParameter(String parameter) {
//         this.parameter = parameter;
//     }
// 
//     private static final String FORBIDDEN_USER_EXCEPTION_MSG_KEY = "forbidden-user-exception-msg-key";
//     private static final String NULL_USER_EXCEPTION_MSG_KEY = "null-user-exception-msg-key";
// 
//     public String getExceptionMsgKey() {
//         if (parameter != null) {
//             return FORBIDDEN_USER_EXCEPTION_MSG_KEY;
//         }
//         return NULL_USER_EXCEPTION_MSG_KEY;
//     }
// 
//     private static final long serialVersionUID = 6868141361082941720L;
// 
//     public ForbiddenUserException(String parameter) {
//         this.parameter = parameter;
//     }
// 
//     public ForbiddenUserException() {}
// 
// }
// 
// Path: tanaguru-survey-impl/src/test/java/org/opens/tanaguru/survey/test/util/DecoratorFactory.java
// public final class DecoratorFactory {
// 
//     public static UserDataServiceDecorator getUserDataServiceDecorator() {
//         UserDataServiceDecoratorImpl udsd =
//                 new UserDataServiceDecoratorImpl(new UserDataServiceMock());
//         udsd.setEntityDao(new UserDAOMock());
//         return udsd;
//     }
// 
//     public static ContractDataServiceDecorator getContractDataServiceDecorator() {
//         ContractDataServiceDecoratorImpl cdsd =
//                 new ContractDataServiceDecoratorImpl(new ContractDataServiceMock());
//         cdsd.setEntityDao(new ContractDAOMock());
//         return cdsd;
//     }
//     
// }
// 
// Path: tanaguru-survey-api/src/main/java/org/opens/tanaguru/survey/view/data/SynthesisData.java
// public interface SynthesisData {
// 
//     /**
//      *
//      * @return
//      */
//     int getTotalNumberOfMonitoredSite();
// 
//     /**
//      * 
//      * @param totalNumberOfMonitoredSite
//      */
//     void setTotalNumberOfMonitoredSite(int totalNumberOfMonitoredSite);
// 
//     /**
//      *
//      * @return
//      */
//     Collection<DetailedSurveyList> getSpotlightSurveyList();
// 
//     /**
//      *
//      * @param spotlightSurveyList
//      */
//     void setSpotlightSurveyList(Collection<DetailedSurveyList> spotlightSurveyList);
// 
// }


// Path: tanaguru-survey-impl/src/test/java/org/opens/tanaguru/survey/view/data/factory/SynthesisDataFactoryImplTest.java
import org.opens.tanaguru.survey.exception.ForbiddenUserException;
import org.opens.tanaguru.survey.test.util.DecoratorFactory;
import org.opens.tanaguru.survey.view.data.SynthesisData;
import junit.framework.TestCase;

/*
 * Tanaguru - Automated webpage assessment
 * Copyright (C) 2008-2011  Open-S Company
 *
 * This file is part of Tanaguru.
 *
 * Tanaguru is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Contact us by mail: open-s AT open-s DOT com
 */
package org.opens.tanaguru.survey.view.data.factory;


/**
 *
 * @author jkowalczyk
 */
public class SynthesisDataFactoryImplTest extends TestCase {
    
    public SynthesisDataFactoryImplTest(String testName) {
        super(testName);
    }

    public void testCreateContractResult() {
        SynthesisDataFactoryImpl sdfi = new SynthesisDataFactoryImpl();
        sdfi.setContractDataServiceDecorator(DecoratorFactory.getContractDataServiceDecorator());
        sdfi.setUserDataServiceDecorator(DecoratorFactory.getUserDataServiceDecorator());
        sdfi.setDetailedSurveyListFactory(DetailedSurveyListFactoryImplTest.getInitialisedSurveyListFactory(null));
        sdfi.setSpotlightList(null);
        sdfi.setUserListPrefix("mock-label");
        SynthesisData idp = sdfi.createSynthesisData();
        assertEquals(4, idp.getTotalNumberOfMonitoredSite());
        assertTrue(idp.getSpotlightSurveyList().isEmpty());
        sdfi.setUserListPrefix(null);
        idp = sdfi.createSynthesisData();
        assertEquals(4, idp.getTotalNumberOfMonitoredSite());
        sdfi.setUserListPrefix("other-label");
        idp = sdfi.createSynthesisData();
        assertEquals(0, idp.getTotalNumberOfMonitoredSite());
        sdfi.setSpotlightList("user1@tanaguru.org");
        idp = sdfi.createSynthesisData();
        assertEquals(1, idp.getSpotlightSurveyList().size());