コード例 #1
0
 @Test
 public void testParseIssueNonUnicodeSymbols() throws IOException, JSONException {
   String json = MyIOUtils.getResourceAsString("issues_foreign_symbols.json");
   String nonLatinAccentSymbols = "Accent symbols: Ação";
   String nonLatinRussianSymbols = "Russian symbols: Привет";
   List<Issue> issues =
       JsonInput.getListOrEmpty(
           RedmineJSONParser.getResponse(json), "issues", RedmineJSONParser.ISSUE_PARSER);
   // must be 2 issues in the file
   Assert.assertTrue(issues.size() == 2);
   assertNotNull(RedmineTestUtils.findIssueInList(issues, nonLatinRussianSymbols));
   assertNotNull(RedmineTestUtils.findIssueInList(issues, nonLatinAccentSymbols));
 }
コード例 #2
0
 /**
  * regression test for http://code.google.com/p/redmine-java-api/issues/detail?id=91 with Redmine
  * 1.3.0: NULL value returned by getIssues call is interpreted as 0.0
  */
 @Test
 public void nullEstimatedTimeProcessedCorrectlyWithRedmine122() {
   try {
     String str = MyIOUtils.getResourceAsString("redmine_1.2.2_dev_issues.json");
     List<Issue> issues =
         JsonInput.getListOrEmpty(
             RedmineJSONParser.getResponse(str), "issues", RedmineJSONParser.ISSUE_PARSER);
     Issue issue = RedmineTestUtils.findIssueInList(issues, 4808);
     assertNull(issue.getEstimatedHours());
     Issue issue1 = RedmineTestUtils.findIssueInList(issues, 4809);
     assertNull(issue1.getEstimatedHours());
   } catch (Exception e) {
     e.printStackTrace();
     Assert.fail("Error:" + e);
   }
 }
コード例 #3
0
 @Test
 public void testUpdatedOn() throws IOException, JSONException {
   List<Issue> redmine11Issues = loadRedmine11Issues();
   Issue issue = RedmineTestUtils.findIssueInList(redmine11Issues, 39);
   DateComparator.testLongDate(
       2011, Calendar.SEPTEMBER, 17, 21, 28, 45, "GMT-8", issue.getUpdatedOn());
 }
コード例 #4
0
 @Test
 public void testCreatedOn() throws IOException, JSONException {
   List<Issue> redmine11Issues = loadRedmine11Issues();
   Issue issue = RedmineTestUtils.findIssueInList(redmine11Issues, 39);
   DateComparator.testLongDate(
       2011, Calendar.FEBRUARY, 12, 16, 0, 31, "GMT-8", issue.getCreatedOn());
 }
コード例 #5
0
 @Test
 public void testParseDescription() {
   try {
     List<Issue> issues = loadRedmine11Issues();
     Issue issue65 = RedmineTestUtils.findIssueInList(issues, 65);
     Assert.assertTrue(
         issue65.getDescription().startsWith("This is the description for the new task."));
     Assert.assertTrue(issue65.getDescription().endsWith("This is the last line."));
   } catch (Exception e) {
     Assert.fail(e.getMessage());
   }
 }
コード例 #6
0
  @Test
  public void estimatedTimeIsNULL() throws JSONException {
    try {
      List<Issue> issues = loadRedmine11Issues();
      Integer issueID = 52;
      Issue issue52 = RedmineTestUtils.findIssueInList(issues, issueID);
      Assert.assertNotNull(issue52);

      // must be NULL and not "0"
      Assert.assertNull("estimated time must be null", issue52.getEstimatedHours());
    } catch (IOException e) {
      Assert.fail(e.getMessage());
    }
  }
コード例 #7
0
  @Test
  public void testParseIssues() throws IOException, JSONException {
    List<Issue> objects = loadRedmine11Issues();
    Integer issueId = 68;
    Issue issue68 = RedmineTestUtils.findIssueInList(objects, issueId);
    Assert.assertNotNull(issue68);
    Assert.assertEquals(issueId, issue68.getId());
    Integer statusId = 1;
    Assert.assertEquals(statusId, issue68.getStatusId());
    Assert.assertEquals("New", issue68.getStatusName());

    User author = issue68.getAuthor();
    Assert.assertNotNull(author);
    Integer userId = 1;
    Assert.assertEquals(userId, author.getId());
  }