aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/PersonalNoteTest.java
diff options
context:
space:
mode:
authorMarco Jacob <mjacob@union06.de>2013-11-05 00:25:45 -0800
committerMarco Jacob <mjacob@union06.de>2013-11-05 00:25:45 -0800
commitaa5f703a8017799eada6938183b1e668b757297d (patch)
treec47dd1fd2d03fd43b3d71c07b30220b26751c5b3 /tests/src/cgeo/geocaching/PersonalNoteTest.java
parenta55dd0d44805a82c7f80b8dca6ae9c31ebb239a7 (diff)
parenta23957d148929a2ac0c463c88ddd09104fd5f9bb (diff)
downloadcgeo-aa5f703a8017799eada6938183b1e668b757297d.zip
cgeo-aa5f703a8017799eada6938183b1e668b757297d.tar.gz
cgeo-aa5f703a8017799eada6938183b1e668b757297d.tar.bz2
Merge pull request #3407 from marco-dev/personalNote4000
fixes #3325 - warning on upload if personal note exceeds 4000
Diffstat (limited to 'tests/src/cgeo/geocaching/PersonalNoteTest.java')
-rw-r--r--tests/src/cgeo/geocaching/PersonalNoteTest.java17
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();