diff options
Diffstat (limited to 'tests/src/cgeo/geocaching/PersonalNoteTest.java')
| -rw-r--r-- | tests/src/cgeo/geocaching/PersonalNoteTest.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/PersonalNoteTest.java b/tests/src/cgeo/geocaching/PersonalNoteTest.java index c31662f..38085d5 100644 --- a/tests/src/cgeo/geocaching/PersonalNoteTest.java +++ b/tests/src/cgeo/geocaching/PersonalNoteTest.java @@ -1,7 +1,10 @@ package cgeo.geocaching; +import cgeo.geocaching.connector.gc.GCConstants; import cgeo.geocaching.list.StoredList; +import org.apache.commons.lang3.StringUtils; + import junit.framework.TestCase; public class PersonalNoteTest extends TestCase { @@ -25,6 +28,20 @@ public class PersonalNoteTest extends TestCase { assertPersonalNote(parsedNote, null, "Simple provider note"); } + public static void testLocalNoteExceedsLimit() { + String testString = StringUtils.repeat("x", GCConstants.PERSONAL_NOTE_MAX_CHARS + 1); + Geocache truncCache = new Geocache(); + truncCache.setPersonalNote(testString.substring(0, GCConstants.PERSONAL_NOTE_MAX_CHARS)); + PersonalNote parsedNote = new PersonalNote(truncCache); + + Geocache exceedingCache = new Geocache(); + exceedingCache.setListId(StoredList.STANDARD_LIST_ID); // stored + exceedingCache.setPersonalNote(testString.toString()); + PersonalNote otherNote = new PersonalNote(exceedingCache); + PersonalNote result = parsedNote.mergeWith(otherNote); + assertPersonalNote(result, null, testString.toString()); + } + public static void testParseCgeoOnly() { final String testString = "Simple cgeo note"; Geocache cache = new Geocache(); |
