diff options
| author | Marco Jacob <mjacob@union06.de> | 2013-11-02 07:55:56 +0100 |
|---|---|---|
| committer | Marco Jacob <mjacob@union06.de> | 2013-11-04 18:24:15 +0100 |
| commit | a23957d148929a2ac0c463c88ddd09104fd5f9bb (patch) | |
| tree | 182c5d52c47f8ad50688e25745ce9bcb575a5fcc /tests | |
| parent | bd9535698bd9239bc6e60580c20e6c275449ff61 (diff) | |
| download | cgeo-a23957d148929a2ac0c463c88ddd09104fd5f9bb.zip cgeo-a23957d148929a2ac0c463c88ddd09104fd5f9bb.tar.gz cgeo-a23957d148929a2ac0c463c88ddd09104fd5f9bb.tar.bz2 | |
fixes #3325 - warning on upload if personal note exceeds 4000
Diffstat (limited to 'tests')
| -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(); |
