Package net.sf.pmr.agilePlanning.domain.story

Examples of net.sf.pmr.agilePlanning.domain.story.Story


      Iteration iteration = new IterationImpl();
      iteration.setDays(40);
      iteration.setStories(new HashSet<Story>());
     
      // mock de story
      Story mockStory1 = mocksControl.createMock(Story.class);
      Story mockStory2 = mocksControl.createMock(Story.class);
     
         EasyMock.expect(mockStory1.daysCompleted()).andReturn(new Double(10));
      EasyMock.expect(mockStory1.daysRemaining()).andReturn(new Double(10));
      iteration.getStories().add(mockStory1);
     
         EasyMock.expect(mockStory2.daysCompleted()).andReturn(new Double(5));
      EasyMock.expect(mockStory2.daysRemaining()).andReturn(new Double(5));
      iteration.getStories().add(mockStory2);

       
        // set mock in replay mode
        mocksControl.replay();   
View Full Code Here


      Iteration iteration = new IterationImpl();
      iteration.setDays(40);
      iteration.setStories(new HashSet<Story>());
     
      // mock de story
      Story mockStory1 = mocksControl.createMock(Story.class);
      Story mockStory2 = mocksControl.createMock(Story.class);
     
         EasyMock.expect(mockStory1.daysCompleted()).andReturn(new Double(10));
      EasyMock.expect(mockStory1.daysRemaining()).andReturn(new Double(10));
      iteration.getStories().add(mockStory1);
     
         EasyMock.expect(mockStory2.daysCompleted()).andReturn(new Double(20));
      EasyMock.expect(mockStory2.daysRemaining()).andReturn(new Double(10));
      iteration.getStories().add(mockStory2);
       
        // set mock in replay mode
        mocksControl.replay();  
     
View Full Code Here

      Iteration iteration = new IterationImpl();
      iteration.setDays(40);
      iteration.setStories(new HashSet<Story>());
     
      // mock de story
      Story mockStory1 = mocksControl.createMock(Story.class);
      Story mockStory2 = mocksControl.createMock(Story.class);
     
         EasyMock.expect(mockStory1.daysCompleted()).andReturn(new Double(10));
      EasyMock.expect(mockStory1.daysRemaining()).andReturn(new Double(10));
      iteration.getStories().add(mockStory1);
     
         EasyMock.expect(mockStory2.daysCompleted()).andReturn(new Double(10));
      EasyMock.expect(mockStory2.daysRemaining()).andReturn(new Double(10));
     
//       set mock in replay mode
        mocksControl.replay()
     
      iteration.getStories().add(mockStory2);
View Full Code Here

     * <li>Enregistrement</li>
     * </ul>
     */
    public void testAddStoryObject() {
       
        Story story = new StoryImpl();
       
        BusinessValue businessValue = new BusinessValueImpl();
        businessValue.setId(1);
        businessValue.setDescription("Hight");
       
        RiskLevel riskLevel = new RiskLevelImpl();
        riskLevel.setId(2);
        riskLevel.setDescription("Low");

        story.setPersistanceId(1);
        story.setBusinessValue(businessValue);
        story.setRiskLevel(riskLevel);
       
        Project project = new ProjectImpl();
        project.setPersistanceId(5);
        story.setProject(project);
       
        story.setShortDescription("titi");
        story.setDescription("toto");
        story.setDaysEstimated(2);
       
       
        // validation
        EasyMock.expect(mockStoryValidator.validate(story)).andReturn(errors);
       
View Full Code Here

    public void testAddWhenValidationFails() {

        // TODO comment tester unitairement la construction de l'objet à l'aide de la factory ???

       
        Story story = new StoryImpl();
       
        BusinessValue businessValue = new BusinessValueImpl();
        businessValue.setId(1);
       
        RiskLevel riskLevel = new RiskLevelImpl();
        riskLevel.setId(2);

        story.setPersistanceId(1);
        story.setBusinessValue(businessValue);
        story.setRiskLevel(riskLevel);
       
        Project project = new ProjectImpl();
        project.setPersistanceId(5);
        story.setProject(project);
       
        story.setShortDescription("titi");
        story.setDescription("toto");
        story.setDaysEstimated(2);
       
        //MockCore.startBlock();
       
        // recherche bu basicProject
        EasyMock.expect(mockProjectRepository.findByPersistanceId(story.getProject().getPersistanceId())).andReturn(project);
       
        // recherche des business value et risk level
        EasyMock.expect(mockBusinessValueRepository.findById(story.getBusinessValue().getId())).andReturn(businessValue);

        EasyMock.expect(mockRiskLevelRepository.findById(story.getRiskLevel().getId())).andReturn(riskLevel);
      
        //MockCore.endBlock();

        // validation
        errors.reject("code");
        EasyMock.expect(mockStoryValidator.validate(EasyMock.isA(Story.class))).andReturn(errors);
       
        // set mock in replay mode
        mocksControl.replay();

        Errors errorsFromService = storyService.add(story.getProject().getPersistanceId(), story.getShortDescription(), story.getDescription(), story.getDaysEstimated(), story.getBusinessValue().getId(), story.getRiskLevel().getId());

        // Vérification des appels
        mocksControl.verify();
       
        // les erreurs sont retournées
View Full Code Here

     * <li>Enregistrement</li>
     * </ul>
     */
    public void testAddStoryObjectWhenValidationFails() {
       
        Story story = new StoryImpl();
       
        BusinessValue businessValue = new BusinessValueImpl();
        businessValue.setId(1);
        businessValue.setDescription("Hight");
       
        RiskLevel riskLevel = new RiskLevelImpl();
        riskLevel.setId(2);
        riskLevel.setDescription("Low");

        story.setPersistanceId(1);
        story.setBusinessValue(businessValue);
        story.setRiskLevel(riskLevel);
       
        Project project = new ProjectImpl();
        project.setPersistanceId(5);
        story.setProject(project);
       
        story.setShortDescription("titi");
        story.setDescription("toto");
        story.setDaysEstimated(2);
       
       
        // validation
        errors.reject("code");       
        EasyMock.expect(mockStoryValidator.validate(story)).andReturn(errors);
View Full Code Here

    public void testAddTask() {

        // TODO comment tester unitairement la construction de l'objet à l'aide de la factory ???

        // recherche de la story
        Story story =  new StoryImpl();
        story.setTasks(new HashSet<Task>());
       
        EasyMock.expect(mockStoryRepository.findByPersistanceId(1)).andReturn(story);
     
        // validation (sans erreurs)
        EasyMock.expect(mockTaskValidator.validate(EasyMock.isA(Task.class))).andReturn(AgilePlanningObjectFactory.getErrors());
       
        // ajout
        mockStoryRepository.addOrUpdate(story);
       
        // set mock in replay mode
        mocksControl.replay();

        Errors errorsFromService = storyService.addTask(1, 2, "toto", 2);

        // Vérifie les appels
        mocksControl.verify();

        // aucune erreur n'est retournée (car pas de validation)
        assertFalse(errorsFromService.hasErrors());
       
        // test de l'ajout de la tâche dans le liste de la story
        for (Iterator iterator = story.getTasks().iterator(); iterator.hasNext();) {
            Task task = (Task) iterator.next();
           
            assertEquals("toto", task.getShortDescription());
            assertEquals(2.0, task.getDaysEstimated());
           
View Full Code Here

     * </ul>
     */
    public void testAddTaskWhenStoryIsNotFound() {
     
        // recherche de la story
        Story story =  null;
        EasyMock.expect(mockStoryRepository.findByPersistanceId(1)).andReturn(story);
       
        // set mock in replay mode
        mocksControl.replay();
       
View Full Code Here

     * </ul>
     */
    public void testAddTaskWhenValidationFails() {

        // recherche de la story
        Story story =  new StoryImpl();
        story.setTasks(new HashSet<Task>());
        EasyMock.expect(mockStoryRepository.findByPersistanceId(1)).andReturn(story);
     
        // validation (avec erreurs)
        Errors errors = AgilePlanningObjectFactory.getErrors();
        errors.reject("erreur");
View Full Code Here

     
      // deux stories sont trouvées
      assertEquals(2, stories.size());
     
        // Story to Update
        Story story1 = new StoryImpl();
        story1.setProject(project);
        story1.setDescription("faire un report d'avancement des tâches à modifier");
        story1.setDaysEstimated(10);
        story1.setPersistanceId(1);
        story1.setPersistanceVersion(2);
        story1.setShortDescription("avancement des tâches à modifier");
        story1.setBusinessValue(businessValue);
        story1.setRiskLevel(riskLevel);

        Story story2 = new StoryImpl();
        story2.setProject(project);
        story2.setDescription("faire une revue de code de l'iteration courant");
        story2.setDaysEstimated(1);
        story2.setPersistanceId(2);
        story2.setPersistanceVersion(2);
        story2.setShortDescription("revue de code");
        story2.setBusinessValue(businessValue);
        story2.setRiskLevel(riskLevel);
     
      // ... et sont dans la liste
      assertTrue(stories.contains(story1));
        assertTrue(stories.contains(story2));
     
View Full Code Here

TOP

Related Classes of net.sf.pmr.agilePlanning.domain.story.Story

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.