source: josm/trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDiscussionCommentTest.java@ 13079

Last change on this file since 13079 was 12035, checked in by Don-vip, 7 years ago

add more unit tests

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4import static org.junit.Assert.assertEquals;
5
6import java.util.Date;
7
8import org.junit.Rule;
9import org.junit.Test;
10import org.openstreetmap.josm.testutils.JOSMTestRules;
11
12import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
13
14/**
15 * Unit tests for class {@link ChangesetDiscussionComment}.
16 */
17public class ChangesetDiscussionCommentTest {
18
19 /**
20 * Setup test.
21 */
22 @Rule
23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
24 public JOSMTestRules test = new JOSMTestRules();
25
26 /**
27 * Unit test of {@link ChangesetDiscussionComment} constructor.
28 */
29 @Test
30 public void testChangesetDiscussionComment() {
31 Date d = new Date(1000);
32 User foo = User.createOsmUser(1, "foo");
33 ChangesetDiscussionComment cdc = new ChangesetDiscussionComment(d, foo);
34 assertEquals(d, cdc.getDate());
35 assertEquals(foo, cdc.getUser());
36 assertEquals("ChangesetDiscussionComment [date=Thu Jan 01 00:00:01 UTC 1970, user=id:1 name:foo, text='null']", cdc.toString());
37 }
38
39 /**
40 * Unit test of methods {@link ChangesetDiscussionComment#setText} / {@link ChangesetDiscussionComment#getText}.
41 */
42 @Test
43 public void testText() {
44 ChangesetDiscussionComment cdc = new ChangesetDiscussionComment(new Date(), null);
45 cdc.setText("foo");
46 assertEquals("foo", cdc.getText());
47 }
48}
Note: See TracBrowser for help on using the repository browser.