Package com.taskadapter.redmineapi.bean

Examples of com.taskadapter.redmineapi.bean.Issue


    }

    @Test
    public void testIssueDoneRatio() {
        try {
            Issue issue = new Issue();
            String subject = "Issue " + new Date();
            issue.setSubject(subject);

            Issue createdIssue = issueManager.createIssue(projectKey, issue);
            assertEquals("Initial 'done ratio' must be 0", (Integer) 0,
                    createdIssue.getDoneRatio());
            Integer doneRatio = 50;
            createdIssue.setDoneRatio(doneRatio);
            issueManager.update(createdIssue);

            Integer issueId = createdIssue.getId();
            Issue reloadedFromRedmineIssue = issueManager.getIssueById(issueId);
            assertEquals(
                    "Checking if 'update issue' operation changed 'done ratio' field",
                    doneRatio, reloadedFromRedmineIssue.getDoneRatio());

            Integer invalidDoneRatio = 130;
            reloadedFromRedmineIssue.setDoneRatio(invalidDoneRatio);
            try {
                issueManager.update(reloadedFromRedmineIssue);
            } catch (RedmineProcessingException e) {
                assertEquals("Must be 1 error", 1, e.getErrors().size());
                assertEquals("Checking error text",
                        "% Done is not included in the list", e.getErrors()
                                .get(0));
            }

            Issue reloadedFromRedmineIssueUnchanged = issueManager.getIssueById(issueId);
            assertEquals(
                    "'done ratio' must have remained unchanged after invalid value",
                    doneRatio, reloadedFromRedmineIssueUnchanged.getDoneRatio());
        } catch (Exception e) {
            fail(e.toString());
        }
    }
View Full Code Here


    }

    @Test
    public void testIssueNullDescriptionDoesNotEraseIt() {
        try {
            Issue issue = new Issue();
            String subject = "Issue " + new Date();
            String descr = "Some description";
            issue.setSubject(subject);
            issue.setDescription(descr);

            Issue createdIssue = issueManager.createIssue(projectKey, issue);
            assertEquals("Checking description", descr,
                    createdIssue.getDescription());

            createdIssue.setDescription(null);
            issueManager.update(createdIssue);

            Integer issueId = createdIssue.getId();
            Issue reloadedFromRedmineIssue = issueManager.getIssueById(issueId);
            assertEquals("Description must not be erased", descr,
                    reloadedFromRedmineIssue.getDescription());

            reloadedFromRedmineIssue.setDescription("");
            issueManager.update(reloadedFromRedmineIssue);

            Issue reloadedFromRedmineIssueUnchanged = issueManager.getIssueById(issueId);
            assertEquals("Description must be erased", "",
                    reloadedFromRedmineIssueUnchanged.getDescription());
        } catch (Exception e) {
            fail();
        }
    }
View Full Code Here

    @Test
    public void testIssueJournals() {
        try {
            // create at least 1 issue
            Issue issueToCreate = new Issue();
            issueToCreate.setSubject("testGetIssues: " + new Date());
            Issue newIssue = issueManager.createIssue(projectKey, issueToCreate);

            Issue loadedIssueWithJournals = issueManager.getIssueById(newIssue.getId(),
                    Include.journals);
            assertTrue(loadedIssueWithJournals.getJournals().isEmpty());

            String commentDescribingTheUpdate = "some comment describing the issue update";
            loadedIssueWithJournals.setSubject("new subject");
            loadedIssueWithJournals.setNotes(commentDescribingTheUpdate);
            issueManager.update(loadedIssueWithJournals);

            Issue loadedIssueWithJournals2 = issueManager.getIssueById(newIssue.getId(),
                    Include.journals);
            assertEquals(1, loadedIssueWithJournals2.getJournals()
                    .size());

            Journal journalItem = loadedIssueWithJournals2.getJournals().iterator().next();
            assertEquals(commentDescribingTheUpdate, journalItem.getNotes());
            User ourUser = IntegrationTestHelper.getOurUser();
            // can't compare User objects because either of them is not
            // completely filled
            assertEquals(ourUser.getId(), journalItem.getUser().getId());
            assertEquals(ourUser.getFirstName(), journalItem.getUser()
                    .getFirstName());
            assertEquals(ourUser.getLastName(), journalItem.getUser()
                    .getLastName());
            assertEquals(1, journalItem.getDetails().size());
            final JournalDetail journalDetail = journalItem.getDetails().get(0);
            assertEquals("new subject", journalDetail.getNewValue());
            assertEquals("subject", journalDetail.getName());
            assertEquals("attr", journalDetail.getProperty());

            Issue loadedIssueWithoutJournals = issueManager.getIssueById(newIssue.getId());
            assertTrue(loadedIssueWithoutJournals.getJournals().isEmpty());

        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
View Full Code Here

            fail(e.getMessage());
        }
    }
    @Test
    public void emptyDescriptionReturnedAsEmptyString() throws RedmineException {
        Issue issue = IssueFactory.createWithSubject("Issue " + new Date());
        Issue createdIssue = issueManager.createIssue(projectKey, issue);
        assertEquals("Description must be an empty string, not NULL", "",
                createdIssue.getDescription());
    }
View Full Code Here

                createdIssue.getDescription());
    }

    @Test
    public void updateIssueDescription() throws RedmineException {
        Issue issue = new Issue();
        issue.setSubject("test123");
        final Issue iss1 = issueManager.createIssue(projectKey, issue);
        final Issue iss2 = IssueFactory.create(iss1.getId());
        iss2.setDescription("This is a test");
        issueManager.update(iss2);
        final Issue iss3 = issueManager.getIssueById(iss2.getId());
        assertEquals("test123", iss3.getSubject());
        assertEquals("This is a test", iss3.getDescription());
    }
View Full Code Here

        assertEquals("This is a test", iss3.getDescription());
    }

    @Test
    public void updateIssueTitle() throws RedmineException {
        Issue issue = new Issue();
        issue.setSubject("test123");
        issue.setDescription("Original description");
        final Issue iss1 = issueManager.createIssue(projectKey, issue);
        final Issue iss2 = IssueFactory.create(iss1.getId());
        iss2.setSubject("New subject");
        issueManager.update(iss2);
        final Issue iss3 = issueManager.getIssueById(iss2.getId());
        assertEquals("New subject", iss3.getSubject());
        assertEquals("Original description", iss3.getDescription());
    }
View Full Code Here

    /**
     * Test for issue 64 (time entry format)
     */
    @Test
    public void testTimeEntryComments() throws RedmineException {
        Issue issue = createIssues(issueManager, projectKey, 1).get(0);
        Integer issueId = issue.getId();

        TimeEntry entry = TimeEntryFactory.create();
        Float hours = 11f;
        entry.setHours(hours);
        entry.setIssueId(issueId);
View Full Code Here

        assertNotNull(list);
    }

    @Test
    public void testCreateGetTimeEntry() throws RedmineException {
        Issue issue = createIssues(issueManager, projectKey, 1).get(0);
        Integer issueId = issue.getId();

        TimeEntry entry = TimeEntryFactory.create();
        Float hours = 11f;
        entry.setHours(hours);
        entry.setIssueId(issueId);
View Full Code Here

        assertEquals(newHours, updatedEntry.getHours());
    }

    @Test(expected = NotFoundException.class)
    public void testCreateDeleteTimeEntry() throws RedmineException {
        Issue issue = createIssues(issueManager, projectKey, 1).get(0);
        Integer issueId = issue.getId();

        TimeEntry entry = TimeEntryFactory.create();
        Float hours = 4f;
        entry.setHours(hours);
        entry.setIssueId(issueId);
View Full Code Here

        issueManager.getTimeEntry(createdEntry.getId());
    }

    @Test
    public void testGetTimeEntriesForIssue() throws RedmineException {
        Issue issue = createIssues(issueManager, projectKey, 1).get(0);
        Integer issueId = issue.getId();
        Float hours1 = 2f;
        Float hours2 = 7f;
        Float totalHoursExpected = hours1 + hours2;
        TimeEntry createdEntry1 = createTimeEntry(issueId, hours1);
        TimeEntry createdEntry2 = createTimeEntry(issueId, hours2);
View Full Code Here

TOP

Related Classes of com.taskadapter.redmineapi.bean.Issue

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.