<commit_before>package edu.northwestern.bioinformatics.studycalendar.restlets;

import edu.northwestern.bioinformatics.studycalendar.dao.SubjectDao;
import edu.northwestern.bioinformatics.studycalendar.domain.*;
import static edu.northwestern.bioinformatics.studycalendar.domain.Fixtures.*;
import static edu.northwestern.bioinformatics.studycalendar.core.Fixtures.createBasicTemplate;
import edu.northwestern.bioinformatics.studycalendar.xml.writers.StudySubjectAssignmentXmlSerializer;
import edu.northwestern.bioinformatics.studycalendar.service.AuthorizationService;
import static edu.nwu.bioinformatics.commons.DateUtils.createDate;

import java.util.Calendar;
import java.util.List;
import java.util.ArrayList;


import static org.easymock.EasyMock.expect;
import org.restlet.data.Status;
import org.restlet.data.MediaType;
import org.restlet.data.Preference;
import gov.nih.nci.cabig.ctms.lang.NowFactory;
import gov.nih.nci.cabig.ctms.lang.StaticNowFactory;


/**
 * @author <NAME>
 */
public class SubjectCentricScheduleResourceTest extends AuthorizedResourceTestCase<SubjectCentricScheduleResource>{
    private SubjectDao subjectDao;
    private AuthorizationService authorizationService;
    private static final String SUBJECT_IDENTIFIER = "1111";
    private Subject subject;
    private List<StudySubjectAssignment> studySubjectAssignments = new ArrayList<StudySubjectAssignment>();
    private NowFactory nowFactory;

    public void setUp() throws Exception {
        super.setUp();
        xmlSerializer = registerMockFor(StudySubjectAssignmentXmlSerializer.class);
        authorizationService = registerMockFor(AuthorizationService.class);
        subjectDao = registerDaoMockFor(SubjectDao.class);
        subject = createSubject("1111", "Perry", "Duglas", createDate(1980, Calendar.JANUARY, 15, 0, 0, 0), Gender.MALE);
        subject.setId(11);
        Study study = createBasicTemplate();
        Site site = createSite("NU");
        StudySubjectAssignment studySubjectAssignment = createAssignment(study,site,subject);
        study = Fixtures.createSingleEpochStudy("S", "Treatment");
        Epoch epoch = study.getPlannedCalendar().getEpochs().get(0);
        epoch.setId(11);
        StudySegment studySegment = epoch.getStudySegments().get(0);
        studySegment.setName("Segment1");
        studySegment.setId(21);
        ScheduledStudySegment scheduledStudySegment = Fixtures.createScheduledStudySegment(studySegment);
        studySubjectAssignment.getScheduledCalendar().addStudySegment(scheduledStudySegment);
        studySubjectAssignments.add(studySubjectAssignment);
        ((StudySubjectAssignmentXmlSerializer)xmlSerializer).setSubjectCentric(true);<commit_msg>Fix test broken in r4069.<commit_after>package edu.northwestern.bioinformatics.studycalendar.restlets;

import static edu.northwestern.bioinformatics.studycalendar.core.Fixtures.createBasicTemplate;
import edu.northwestern.bioinformatics.studycalendar.dao.SubjectDao;
import edu.northwestern.bioinformatics.studycalendar.domain.Epoch;
import edu.northwestern.bioinformatics.studycalendar.domain.Fixtures;
import static edu.northwestern.bioinformatics.studycalendar.domain.Fixtures.*;
import edu.northwestern.bioinformatics.studycalendar.domain.Gender;
import edu.northwestern.bioinformatics.studycalendar.domain.ScheduledStudySegment;
import edu.northwestern.bioinformatics.studycalendar.domain.Site;
import edu.northwestern.bioinformatics.studycalendar.domain.Study;
import edu.northwestern.bioinformatics.studycalendar.domain.StudySegment;
import edu.northwestern.bioinformatics.studycalendar.domain.StudySubjectAssignment;
import edu.northwestern.bioinformatics.studycalendar.domain.Subject;
import edu.northwestern.bioinformatics.studycalendar.service.AuthorizationService;
import edu.northwestern.bioinformatics.studycalendar.xml.writers.StudySubjectAssignmentXmlSerializer;
import static edu.nwu.bioinformatics.commons.DateUtils.createDate;
import gov.nih.nci.cabig.ctms.lang.NowFactory;
import gov.nih.nci.cabig.ctms.lang.StaticNowFactory;
import static org.easymock.EasyMock.expect;
import org.restlet.data.MediaType;
import org.restlet.data.Preference;
import org.restlet.data.Status;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;


/**
 * @author <NAME>
 */
public class SubjectCentricScheduleResourceTest extends AuthorizedResourceTestCase<SubjectCentricScheduleResource>{
    private SubjectDao subjectDao;
    private AuthorizationService authorizationService;
    private static final String SUBJECT_IDENTIFIER = "1111";
    private Subject subject;
    private List<StudySubjectAssignment> studySubjectAssignments = new ArrayList<StudySubjectAssignment>();
    private NowFactory nowFactory;

    public void setUp() throws Exception {
        super.setUp();
        xmlSerializer = registerMockFor(StudySubjectAssignmentXmlSerializer.class);
        authorizationService = registerMockFor(AuthorizationService.class);
        subjectDao = registerDaoMockFor(SubjectDao.class);
        subject = createSubject("1111", "Perry", "Duglas", createDate(1980, Calendar.JANUARY, 15, 0, 0, 0), Gender.MALE);
        subject.setId(11);
        Study study = createBasicTemplate("Joe's Study");
        Site site = createSite("NU");
        StudySubjectAssignment studySubjectAssignment = createAssignment(study,site,subject);
        study = Fixtures.createSingleEpochStudy("S", "Treatment");
        Epoch epoch = study.getPlannedCalendar().getEpochs().get(0);
        epoch.setId(11);
        StudySegment studySegment = epoch.getStudySegments().get(0);
        studySegment.setName("Segment1");
        studySegment.setId(21);
        ScheduledStudySegment scheduledStudySegment = Fixtures.createScheduledStudySegment(studySegment);
        studySubjectAssignment.getScheduledCalendar().addStudySegment(scheduledStudySegment);
        studySubjectAssignments.add(studySubjectAssignment);
        ((StudySubjectAssignmentXmlSerializer)xmlSerializer).setSubjectCentric(true);
{'fraction_non_alphanumeric': 0.09282630355363666, 'fraction_numerical': 0.009299236134174693, 'mean_word_length': 5.699666295884316, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2684857', 'n_tokens_mistral': 1758, 'n_tokens_neox': 1610, 'n_words': 258}