diff options
Diffstat (limited to 'tests')
23 files changed, 477 insertions, 145 deletions
diff --git a/tests/.settings/org.eclipse.jdt.core.prefs b/tests/.settings/org.eclipse.jdt.core.prefs index 5385520..6ba1bbd 100644 --- a/tests/.settings/org.eclipse.jdt.core.prefs +++ b/tests/.settings/org.eclipse.jdt.core.prefs @@ -1,9 +1,10 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve @@ -11,7 +12,7 @@ org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=ignore org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning @@ -20,13 +21,13 @@ org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning @@ -47,37 +48,39 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warni org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullReference=error org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=error org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled @@ -90,6 +93,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference= org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.6 diff --git a/tests/libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar b/tests/libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar Binary files differnew file mode 100644 index 0000000..daca164 --- /dev/null +++ b/tests/libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar diff --git a/tests/res/raw/gc3t1xg_gsak.gpx b/tests/res/raw/gc3t1xg_gsak.gpx new file mode 100644 index 0000000..ebb5ca5 --- /dev/null +++ b/tests/res/raw/gc3t1xg_gsak.gpx @@ -0,0 +1,310 @@ +<?xml version="1.0" encoding="utf-8"?> +<gpx xmlns:xsd="http://www.w3.org/2001/XMLSchema" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +version="1.0" creator="GSAK" +xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.groundspeak.com/cache/1/0/1 http://www.groundspeak.com/cache/1/0/1/cache.xsd http://www.gsak.net/xmlv1/6 http://www.gsak.net/xmlv1/6/gsak.xsd" +xmlns="http://www.topografix.com/GPX/1/0"> + <desc>Geocache file generated by GSAK (HasChildren)</desc> + <author>GSAK</author> + <email>support@gsak.net</email> + <time>2014-01-26T19:54:13Z</time> + <keywords>cache, geocache, groundspeak</keywords> + <bounds minlat="50.1075" minlon="8.65885" maxlat="50.1075" maxlon="8.65885"/> + <wpt lat="50.1075" lon="8.65885"> + <time>2012-08-13T08:00:00Z</time> + <name>GC3T1XG</name> + <desc>Help by TheGreenTool (3/1)</desc> + <url>http://www.geocaching.com/seek/cache_details.aspx?guid=d09416d5-dba9-4347-86a6-12f7b5ef2fff</url> + <urlname>Help by TheGreenTool</urlname> + <sym>Geocache</sym> + <type>Geocache|Traditional Cache</type> + <gsak:wptExtension xmlns:gsak="http://www.gsak.net/xmlv1/6"> + <gsak:UserFlag>true</gsak:UserFlag> + <gsak:Lock>false</gsak:Lock> + <gsak:DNF>false</gsak:DNF> + <gsak:Watch>false</gsak:Watch> + <gsak:UserData></gsak:UserData> + <gsak:FirstToFind>false</gsak:FirstToFind> + <gsak:User2></gsak:User2> + <gsak:User3></gsak:User3> + <gsak:User4></gsak:User4> + <gsak:County></gsak:County> + <gsak:UserSort>0</gsak:UserSort> + <gsak:SmartName>Help</gsak:SmartName> + <gsak:LastGpxDate>2014-01-26</gsak:LastGpxDate> + <gsak:Code>GC3T1XG</gsak:Code> + <gsak:Resolution></gsak:Resolution> + <gsak:IsPremium>true</gsak:IsPremium> + <gsak:FavPoints>258</gsak:FavPoints> + <gsak:GcNote>Personal Note Test</gsak:GcNote> + <gsak:Guid>d09416d5-dba9-4347-86a6-12f7b5ef2fff</gsak:Guid> + <gsak:CacheImages> + </gsak:CacheImages> + <gsak:LogImages> + </gsak:LogImages> + <gsak:CustomData> +Custom_Start:cCode:Custom_Data:GC3T1XG:Custom_End + + </gsak:CustomData> + </gsak:wptExtension> + <groundspeak:cache id="3106063" available="True" archived="False" xmlns:groundspeak="http://www.groundspeak.com/cache/1/0/1"> + <groundspeak:name>Help</groundspeak:name> + <groundspeak:placed_by>TheGreenTool</groundspeak:placed_by> + <groundspeak:owner id="2072379">TheGreenTool</groundspeak:owner> + <groundspeak:type>Traditional Cache</groundspeak:type> + <groundspeak:container>Small</groundspeak:container> + <groundspeak:attributes> + <groundspeak:attribute id="1" inc="1">Dogs</groundspeak:attribute> + <groundspeak:attribute id="7" inc="1">Takes less than an hour</groundspeak:attribute> + <groundspeak:attribute id="13" inc="1">Available at all times</groundspeak:attribute> + <groundspeak:attribute id="15" inc="1">Available during winter</groundspeak:attribute> + <groundspeak:attribute id="24" inc="1">Wheelchair accessible</groundspeak:attribute> + <groundspeak:attribute id="32" inc="1">Bicycles</groundspeak:attribute> + <groundspeak:attribute id="33" inc="1">Motorcycles</groundspeak:attribute> + <groundspeak:attribute id="34" inc="1">Quads</groundspeak:attribute> + <groundspeak:attribute id="35" inc="1">Off-road vehicles</groundspeak:attribute> + <groundspeak:attribute id="47" inc="1">Field Puzzle</groundspeak:attribute> + <groundspeak:attribute id="63" inc="1">Tourist Friendly</groundspeak:attribute> + </groundspeak:attributes> + <groundspeak:difficulty>3</groundspeak:difficulty> + <groundspeak:terrain>1</groundspeak:terrain> + <groundspeak:country>Germany</groundspeak:country> + <groundspeak:state>Hessen</groundspeak:state> + <groundspeak:short_description html="True"> </groundspeak:short_description> + <groundspeak:long_description html="True">Ein Cache für Leute, die keine langen Listingtexte lesen wollen.<br /> +Dieses Listing beinhaltet alle Informationen, die ihr benötigt.<br /> +Die Notrufsäule hat absolut NICHTS mit dem Cache zu tun. Lasst sie bitte in Ruhe!<br /> +<br /> +A cache for people who don't like reading long listing texts.<br /> +This listing contains all information you need.<br /> +Please DO NOT use the emergency telephone! It has absolutely NOTHING to do with the cache.<br /> +<br /></groundspeak:long_description> + <groundspeak:encoded_hints></groundspeak:encoded_hints> + <groundspeak:logs> + <groundspeak:log id="378435354"> + <groundspeak:date>2014-01-24T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="4685592">Holleradhiho</groundspeak:finder> + <groundspeak:text encoded="False">Nachdem ich im letzten Jahr den Code nicht rausbekommen habe hat mir meine Freundin den entscheidenden Tipp gegeben. Heute mit den richtigen vorbei gegangen und schnell eingetragen. Vielen Dank für den Cache. Holleradhiho</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="378281233"> + <groundspeak:date>2014-01-22T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="6585656">leontheleon</groundspeak:finder> + <groundspeak:text encoded="False">In Francfurt for a business trip, I quickly loaded in the GPS a few caches around my hotel and the station, +That s awesome to see how much cache there are in Germany. + +After the failure yesterday, i have this in my mind.... + +and suddenly after dinner, +i tried to found information translating the others log... but I didn't need this HELP, +before I start to translate it appears clear and loud : I got the key !!! + +Wait tomorrow to try this, +hopefully the taxi droped me 30 min beore my train leave, +i go +try +and open it ! + +Thanks for this good idea, +I was so sorry if I can t found this one before to leave ! + +Come with me little geocoin, you will visite France. + + +362 ème cache trouvée par leontheleon +Merci à TheGreenTool pour cette cache + +362 geocache found by LeontheLeon +Thanks to TheGreenTool for this cache. + +J'ai donné 4 à cette cache grâce à [url=http://www.gcvote.com]GCVote[/url]</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="378261404"> + <groundspeak:date>2014-01-22T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="2969623">bravo1999</groundspeak:finder> + <groundspeak:text encoded="False">#2881 +Auf der Dienstreise einen Boxenstopp am Frankfurter Hbf eingelegt und die Zwischenzeit natürlich sinnvoll genutzt. +Unweit des Hbf diesen Cache erspäht und nach kurzer Andacht dann auch geloggt. +Klasse Ding, tolle Umsetzung - hat mir sehr gut gefallen - ich liebe Stadtcache, trotz oder vielleicht wg der Muggelei. +Dafür gibt´s auch von mir einen FavPkt und +TFTC sagt bravo1999</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="378231850"> + <groundspeak:date>2014-01-22T16:44:49Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="4950075">DovasTeam</groundspeak:finder> + <groundspeak:text encoded="False">Sehr gut. +MfG aus Griechenland. +Dfdc</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="378194961"> + <groundspeak:date>2014-01-22T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="4005684">Klaye</groundspeak:finder> + <groundspeak:text encoded="False">TFTC! #815 +Quickly located, but it took me another while to log. TBs exchanged. Favourite point.</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="378280964"> + <groundspeak:date>2014-01-21T20:00:00Z</groundspeak:date> + <groundspeak:type>Didn't find it</groundspeak:type> + <groundspeak:finder id="6585656">leontheleon</groundspeak:finder> + <groundspeak:text encoded="False">In Francfurt for a business trip, I quickly loaded in the GPS a few caches around my hotel and the station, +That s awesome to see how much cache there are in Germany. + +may be a bit of time during my trip to try my first German cache... + +I arrived at 5 pm and before looking for a taxi, I will go for a few ones + +______________________________________ +After the faiulure on "Cafe Metropolitan", I quickly tried this one, + +After a quick inspection, I see the difficulty level and decided to go direct to the next one because not too much time and this is dark now. + +On return walk, I check and see the attributes, quickly see if I can find + +I can imagine what could be the container, but not possible to find the solution... + +Go for hotel... my mind is boiling to be so close + +may be on return tomorrow if I have 15 min free</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="378195032"> + <groundspeak:date>2014-01-21T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="2106220">LouisCyphre</groundspeak:finder> + <groundspeak:text encoded="False">Nach einem kleinen Nachtcache in der Nähe sind muffinstarbucks und ich auch noch mal "schnell" hier vorbei. Am schwierigsten war allerdings das Parkplatz finden und Einparken[:D]. +An der Dose hatte ich dann ein kleines Deja-Vu, genau die Dose hatte ich vom gleichen Owner schon vor ein paar Wochen an einer anderen Stelle gemacht[8D]. +TFTC +#8552</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="378187240"> + <groundspeak:date>2014-01-21T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="1624740">muffinstarbucks</groundspeak:finder> + <groundspeak:text encoded="False">[:D] + +Ein wirklich cooles Versteck. Nach unserem NC kamen LouisCyphre und ich auch noch hier vorbei. Das Cachemobil am Strassenrand abzustellen war genauso schwierig, wie das Auffinden der Dose. Beides +klappte zum Glück am Ende aber gut.[^] + +Einen Favoritenpunkt hierfür. + +TFTC</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="377942548"> + <groundspeak:date>2014-01-20T16:29:02Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="1366147">FlashCool</groundspeak:finder> + <groundspeak:text encoded="False">Schick, schick. Clevere Versteckidee. Heute im 2. Anlauf gut und im Schutze der Dunkelheit finden und heben können. + +Danke fürs Aushecken und Verstecken.</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="377136980"> + <groundspeak:date>2014-01-17T20:00:00Z</groundspeak:date> + <groundspeak:type>Write note</groundspeak:type> + <groundspeak:finder id="2849267">dl1ely</groundspeak:finder> + <groundspeak:text encoded="False">Keine Ahnung, wo die Dose sich verbergen soll, so ganz ohne Hint. Nachdem 2 Polizisten begannen, mir interessiert beim Rumlungern zuzusehen, trat ich lieber den Rückweg zum Bahnhof an. Vielleicht habe ich beim nächsten Umstieg am HBf mehr Glück.</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="376948874"> + <groundspeak:date>2014-01-15T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="613426">Kassabeckabua</groundspeak:finder> + <groundspeak:text encoded="False">Nach einem Abendessen und Zwischenstopp heute im zweiten Anlauf. TFTC KBB</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="376946408"> + <groundspeak:date>2014-01-15T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="2040005">Bembelboy</groundspeak:finder> + <groundspeak:text encoded="False">Ich war ja schon mal bei der Dose als sie noch am vorigen Platz versteckt war. Seinerzeit fehlte mir die Idee und die Muggeldichte war einfach zu hoch. Zwischenzeitlich hatte ich das neue Versteck auch ausfindig gemacht, doch die Muggeldichte war wieder zu hoch und es war hell. Heute Abend im Dunkeln konnte sie sich meinem Zugriff dann nicht mehr entziehen. Ich hatte ca. 2 Stunden vorher in Hamburg eine ahnliche Dose zu öffnen gehabt. Lustig. + +This entry was edited by Bembelboy on Friday, 17 January 2014 at 19:54:02 UTC.</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="376892811"> + <groundspeak:date>2014-01-14T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="7675187">KuWu80</groundspeak:finder> + <groundspeak:text encoded="False">Gesucht, gefunden und geloggt. :-) + +TFTC !!!!</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="376793802"> + <groundspeak:date>2014-01-14T20:00:00Z</groundspeak:date> + <groundspeak:type>Write note</groundspeak:type> + <groundspeak:finder id="6306622">Kaiserwurst86</groundspeak:finder> + <groundspeak:text encoded="False">TB abgelegt. Da es aber nur eine Kopie ist, kann ich ihn hier online nicht ablegen.</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="376766889"> + <groundspeak:date>2014-01-14T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="7169608">Tom Ato</groundspeak:finder> + <groundspeak:text encoded="False">Nach einer kleinen Hilfestellung (DANKE DAFÜR) im zweiten Anlauf gut gelöst. +Sehr schöne Idee, dafür von mir ein FP!!! +TB: out +T4TC!!!</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="376741584"> + <groundspeak:date>2014-01-14T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="5385835">lietuvis28</groundspeak:finder> + <groundspeak:text encoded="False">Vor dem dienstlichen Termin noch schnell diese "Dose" gefunden, geöffnet und geloggt. + +Ich gebe zu, es bracuht auch bei mir einen 2. Anlauf. Bei meiner letzten Dienstreise nach Frankfurt hatte ich noch die Notrufsäule vor Augen. Diese wollte ich aber nicht ausprobieren. +Daher ein wenig nachgedacht, nochmal geschaut, etwas "neues" entdeckt und schon lag das Logbuch in meinen Händen. + +Für die Idee lasse ich gerne ein Schleifchen hier. + +TFTC! + +Gruß aus Windeck</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="378209899"> + <groundspeak:date>2014-01-12T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="2057810">Nerre</groundspeak:finder> + <groundspeak:text encoded="False">Mit TurtleSA und Neonfly ging auf große Tour Richtung Frankfurt. Danke für's Verstecken! + +Zum Abschluß der Tour ging es nochmal durch die Innenstadt. +Ein toller Cache! Hier suchten wir lange weil wir es erst übersahen, dann konnten wir aber direkt loggen. Super! Dafür gibt es einen FP. :)</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="377753263"> + <groundspeak:date>2014-01-12T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="2098778">neonfly</groundspeak:finder> + <groundspeak:text encoded="False">Heute bei gutem Wetter eine Tagestour zusammen mit TurtleSA und Nerre nach Frankfurt unternommen. +Auf dem Weg dorthin haben wir bei Darmstadt auch noch ein paar Dosen geloggt. + +Im wesentlichen waren wir östlich in direkter Flugphafennähe unterwegs, sowie anschliessend in Niederrad und FFM Innenstadt. + +Dies ist ein Sammellog für alle Caches, manche bekommen auch ein Schleifchen. :=) + +Bei der Europatour sind wir nicht alle angegangen und bei einem Cache dieser Serie (Stockholm) hat Nerre ein Ersatzlogbuch gebastelt, da anscheinend die Muggel zugeschlagen hatten. An der richtigen Laterne waren wir. + +Der Portier am Café Metropolitan hat uns durch subtile Hinweise weiter geholfen den Kleinen doch noch zu finden. :) +War eine nette Begegnung. :) + +Ansonsten hat sich Frankfurt ganz schön gemacht in den letzten Jahren (war lange nicht mehr dort gewesen). + +Grüße an alle Owner sowie unsere spontanen Begleiter im Wald südlich Niederrad und natürlich auch an Nerre und TurtleSA. +War eine schöne Runde. :)</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="376878775"> + <groundspeak:date>2014-01-12T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="2518165">friendscout</groundspeak:finder> + <groundspeak:text encoded="False">Schönes Versteck mit Finger-Abzähl-Übung, dafür einen FP. Merci!</groundspeak:text> + </groundspeak:log> + <groundspeak:log id="376250428"> + <groundspeak:date>2014-01-12T20:00:00Z</groundspeak:date> + <groundspeak:type>Found it</groundspeak:type> + <groundspeak:finder id="6167340">eifelmuggel</groundspeak:finder> + <groundspeak:text encoded="False">Schön gemacht. Die Dose hatten wir sofort gefunden, aber wie auf bekommen!? Ich kann bestätigen, dass im Listing alles steht, was man braucht. Genau genommen steht da noch etwas zu viel ;-)! + +Danke!</groundspeak:text> + </groundspeak:log> + </groundspeak:logs> + <groundspeak:travelbugs> + </groundspeak:travelbugs> +</groundspeak:cache> +</wpt> +</gpx> diff --git a/tests/src/cgeo/geocaching/CgeoApplicationTest.java b/tests/src/cgeo/geocaching/CgeoApplicationTest.java index b9c03a4..af6bcaa 100644 --- a/tests/src/cgeo/geocaching/CgeoApplicationTest.java +++ b/tests/src/cgeo/geocaching/CgeoApplicationTest.java @@ -114,7 +114,7 @@ public class CgeoApplicationTest extends CGeoTestCase { public static Geocache testSearchByGeocode(final String geocode) { final SearchResult search = Geocache.searchByGeocode(geocode, null, 0, true, null); assertNotNull(search); - if (Settings.isPremiumMember() || search.getError() == null) { + if (Settings.isGCPremiumMember() || search.getError() == null) { assertEquals(1, search.getGeocodes().size()); assertTrue(search.getGeocodes().contains(geocode)); return DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); @@ -140,14 +140,14 @@ public class CgeoApplicationTest extends CGeoTestCase { */ private static void withMockedLoginDo(final Runnable runnable) { final ImmutablePair<String, String> login = Settings.getGcCredentials(); - final String memberStatus = Settings.getMemberStatus(); + final String memberStatus = Settings.getGCMemberStatus(); try { runnable.run(); } finally { // restore user and password TestSettings.setLogin(login.left, login.right); - Settings.setMemberStatus(memberStatus); + Settings.setGCMemberStatus(memberStatus); GCLogin.getInstance().login(); } } @@ -171,6 +171,8 @@ public class CgeoApplicationTest extends CGeoTestCase { assertTrue(search.getGeocodes().contains(cache.getGeocode())); final Geocache searchedCache = search.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB); // coords must be null if the user is not logged in + assertNotNull(searchedCache); + assert (searchedCache != null); // eclipse bug assertNull(searchedCache.getCoords()); // premium cache. Not visible to guests @@ -237,10 +239,10 @@ public class CgeoApplicationTest extends CGeoTestCase { @Override public void run() { - final SearchResult search = GCParser.searchByCoords(new Geopoint("N 52° 24.972 E 009° 35.647"), CacheType.MYSTERY, false, null); + final SearchResult search = GCParser.searchByCoords(new Geopoint("N 50° 06.654 E 008° 39.777"), CacheType.MYSTERY, false, null); assertNotNull(search); assertTrue(20 <= search.getGeocodes().size()); - assertTrue(search.getGeocodes().contains("GC1RMM2")); + assertTrue(search.getGeocodes().contains("GC1HBMY")); } }); } @@ -305,25 +307,25 @@ public class CgeoApplicationTest extends CGeoTestCase { // check coords for DETAILED Settings.setLiveMapStrategy(Strategy.DETAILED); - SearchResult search = ConnectorFactory.searchByViewport(viewport, tokens); + SearchResult search = ConnectorFactory.searchByViewport(viewport, tokens).toBlockingObservable().single(); assertNotNull(search); assertTrue(search.getGeocodes().contains(mockedCache.getGeocode())); Geocache parsedCache = DataStore.loadCache(mockedCache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB); - assertEquals(Settings.isPremiumMember(), mockedCache.getCoords().equals(parsedCache.getCoords())); - assertEquals(Settings.isPremiumMember(), parsedCache.isReliableLatLon()); + assertEquals(Settings.isGCPremiumMember(), mockedCache.getCoords().equals(parsedCache.getCoords())); + assertEquals(Settings.isGCPremiumMember(), parsedCache.isReliableLatLon()); // check update after switch strategy to FAST Settings.setLiveMapStrategy(Strategy.FAST); Tile.Cache.removeFromTileCache(mockedCache); - search = ConnectorFactory.searchByViewport(viewport, tokens); + search = ConnectorFactory.searchByViewport(viewport, tokens).toBlockingObservable().single(); assertNotNull(search); assertTrue(search.getGeocodes().contains(mockedCache.getGeocode())); parsedCache = DataStore.loadCache(mockedCache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB); - assertEquals(Settings.isPremiumMember(), mockedCache.getCoords().equals(parsedCache.getCoords())); - assertEquals(Settings.isPremiumMember(), parsedCache.isReliableLatLon()); + assertEquals(Settings.isGCPremiumMember(), mockedCache.getCoords().equals(parsedCache.getCoords())); + assertEquals(Settings.isGCPremiumMember(), parsedCache.isReliableLatLon()); } finally { // restore user settings @@ -356,7 +358,7 @@ public class CgeoApplicationTest extends CGeoTestCase { Settings.setCacheType(CacheType.ALL); Viewport viewport = new Viewport(cache, 0.003, 0.003); - SearchResult search = ConnectorFactory.searchByViewport(viewport, INVALID_TOKEN); + SearchResult search = ConnectorFactory.searchByViewport(viewport, INVALID_TOKEN).toBlockingObservable().single(); assertNotNull(search); assertTrue(search.getGeocodes().contains(cache.getGeocode())); @@ -364,7 +366,7 @@ public class CgeoApplicationTest extends CGeoTestCase { final Geocache cacheFromViewport = DataStore.loadCache(cache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB); Log.d("cgeoApplicationTest.testSearchByViewportNotLoggedIn: Coords expected = " + cache.getCoords()); Log.d("cgeoApplicationTest.testSearchByViewportNotLoggedIn: Coords actual = " + cacheFromViewport.getCoords()); - assertFalse(cache.getCoords().isEqualTo(cacheFromViewport.getCoords(), 1e-3)); + assertFalse(cache.getCoords().distanceTo(cacheFromViewport.getCoords()) <= 1e-3); // depending on the chosen strategy the coords can be reliable or not assertEquals(testStrategy == Strategy.DETAILED, cacheFromViewport.isReliableLatLon()); @@ -373,11 +375,11 @@ public class CgeoApplicationTest extends CGeoTestCase { deleteCacheFromDBAndLogout(cache.getGeocode()); viewport = new Viewport(cache, 0.003, 0.003); - search = ConnectorFactory.searchByViewport(viewport, INVALID_TOKEN); + search = ConnectorFactory.searchByViewport(viewport, INVALID_TOKEN).toBlockingObservable().single(); assertNotNull(search); - // depending on the chosen strategy the cache is part of the search or not - assertEquals(testStrategy == Strategy.DETAILED, search.getGeocodes().contains(cache.getGeocode())); + // In the meantime, premium-member caches are also shown on map when not logged in + assertTrue(search.getGeocodes().contains(cache.getGeocode())); } finally { Settings.setLiveMapStrategy(strategy); @@ -423,7 +425,7 @@ public class CgeoApplicationTest extends CGeoTestCase { GCLogin.getInstance().logout(); // Modify login data to avoid an automatic login again TestSettings.setLogin("c:geo", "c:geo"); - Settings.setMemberStatus("Basic member"); + Settings.setGCMemberStatus("Basic member"); } } diff --git a/tests/src/cgeo/geocaching/GeocacheTest.java b/tests/src/cgeo/geocaching/GeocacheTest.java index cdca9b7..b49048b 100644 --- a/tests/src/cgeo/geocaching/GeocacheTest.java +++ b/tests/src/cgeo/geocaching/GeocacheTest.java @@ -249,6 +249,14 @@ public class GeocacheTest extends CGeoTestCase { assertTime("from 11 to 13 " + timeHours, 11, 00); } + public static void testGuessEventTimeShortDescription() { + Geocache cache = new Geocache(); + cache.setType(CacheType.EVENT); + cache.setDescription(StringUtils.EMPTY); + cache.setShortDescription("text 14:20 text"); + assertEquals(String.valueOf(14 * 60 + 20), cache.guessEventTimeMinutes()); + } + private static void assertTime(final String description, final int hours, final int minutes) { final Geocache cache = new Geocache(); cache.setDescription(description); diff --git a/tests/src/cgeo/geocaching/SettingsTest.java b/tests/src/cgeo/geocaching/SettingsTest.java index c58db08..90a0209 100644 --- a/tests/src/cgeo/geocaching/SettingsTest.java +++ b/tests/src/cgeo/geocaching/SettingsTest.java @@ -27,7 +27,7 @@ public class SettingsTest extends ActivityInstrumentationTestCase2<MainActivity> public static void testSettings() { // unfortunately, several other tests depend on being a premium member and will fail if run by a basic member - assertEquals(GCConstants.MEMBER_STATUS_PM, Settings.getMemberStatus()); + assertEquals(GCConstants.MEMBER_STATUS_PM, Settings.getGCMemberStatus()); } public static void testDeviceHasNormalLogin() { diff --git a/tests/src/cgeo/geocaching/connector/ConnectorFactoryTest.java b/tests/src/cgeo/geocaching/connector/ConnectorFactoryTest.java index e41e316..725f718 100644 --- a/tests/src/cgeo/geocaching/connector/ConnectorFactoryTest.java +++ b/tests/src/cgeo/geocaching/connector/ConnectorFactoryTest.java @@ -63,8 +63,32 @@ public class ConnectorFactoryTest extends AbstractResourceInstrumentationTestCas public static void testGetGeocodeFromUrl() { assertEquals("GC34PLO", ConnectorFactory.getGeocodeFromURL("http://coord.info/GC34PLO")); + assertEquals("GC34PLO", ConnectorFactory.getGeocodeFromURL("http://www.coord.info/GC34PLO")); assertEquals("OX1234", ConnectorFactory.getGeocodeFromURL("http://www.opencaching.com/#!geocache/OX1234")); + + assertEquals("GC12ABC", GCConnector.getInstance().getGeocodeFromUrl("http://coord.info/GC12ABC")); + assertEquals("GC12ABC", GCConnector.getInstance().getGeocodeFromUrl("http://www.coord.info/GC12ABC")); + assertEquals("GC12ABC", GCConnector.getInstance().getGeocodeFromUrl("http://www.geocaching.com/geocache/GC12ABC_die-muhlen-im-schondratal-muhle-munchau")); + assertEquals("GC12ABC", GCConnector.getInstance().getGeocodeFromUrl("http://geocaching.com/geocache/GC12ABC_die-muhlen-im-schondratal-muhle-munchau")); + + // trackable URLs + assertNull(GCConnector.getInstance().getGeocodeFromUrl("http://coord.info/TB1234")); + assertNull(GCConnector.getInstance().getGeocodeFromUrl("http://www.coord.info/TB1234")); + // make sure that a mixture of different connector and geocode is recognized as invalid assertNull(ConnectorFactory.getGeocodeFromURL("http://www.opencaching.com/#!geocache/" + "GC12345")); } + + public static void testGetTrackableFromURL() throws Exception { + assertEquals("GK78FA", ConnectorFactory.getTrackableFromURL("http://www.geokrety.org/konkret.php?id=30970")); + assertEquals("GK78FA", ConnectorFactory.getTrackableFromURL("http://geokrety.org/konkret.php?id=30970")); + assertEquals("TB1234", ConnectorFactory.getTrackableFromURL("http://coord.info/TB1234")); + assertEquals("TB1234", ConnectorFactory.getTrackableFromURL("http://www.coord.info/TB1234")); + assertEquals("TB1234", ConnectorFactory.getTrackableFromURL("http://geocaching.com/track/details.aspx?tracker=TB1234")); + assertEquals("TB1234", ConnectorFactory.getTrackableFromURL("http://www.geocaching.com/track/details.aspx?tracker=TB1234")); + + // cache URLs + assertNull(ConnectorFactory.getTrackableFromURL("http://coord.info/GC1234")); + assertNull(ConnectorFactory.getTrackableFromURL("http://www.coord.info/GC1234")); + } } diff --git a/tests/src/cgeo/geocaching/connector/gc/GCConnectorTest.java b/tests/src/cgeo/geocaching/connector/gc/GCConnectorTest.java index a5b9a44..47c3f6f 100644 --- a/tests/src/cgeo/geocaching/connector/gc/GCConnectorTest.java +++ b/tests/src/cgeo/geocaching/connector/gc/GCConnectorTest.java @@ -26,7 +26,7 @@ public class GCConnectorTest extends AbstractResourceInstrumentationTestCase { { final Viewport viewport = new Viewport(new Geopoint("N 52° 25.369 E 9° 35.499"), new Geopoint("N 52° 25.600 E 9° 36.200")); - final SearchResult searchResult = ConnectorFactory.searchByViewport(viewport, tokens); + final SearchResult searchResult = ConnectorFactory.searchByViewport(viewport, tokens).toBlockingObservable().single(); assertNotNull(searchResult); assertFalse(searchResult.isEmpty()); assertTrue(searchResult.getGeocodes().contains("GC4ER5H")); @@ -35,7 +35,7 @@ public class GCConnectorTest extends AbstractResourceInstrumentationTestCase { { final Viewport viewport = new Viewport(new Geopoint("N 52° 24.000 E 9° 34.500"), new Geopoint("N 52° 26.000 E 9° 38.500")); - final SearchResult searchResult = ConnectorFactory.searchByViewport(viewport, tokens); + final SearchResult searchResult = ConnectorFactory.searchByViewport(viewport, tokens).toBlockingObservable().single(); assertNotNull(searchResult); assertTrue(searchResult.getGeocodes().contains("GC4ER5H")); } @@ -88,5 +88,11 @@ public class GCConnectorTest extends AbstractResourceInstrumentationTestCase { public static void testGetGeocodeFromUrl() { assertNull(GCConnector.getInstance().getGeocodeFromUrl("some string")); assertEquals("GC12ABC", GCConnector.getInstance().getGeocodeFromUrl("http://coord.info/GC12ABC")); + assertEquals("GC12ABC", GCConnector.getInstance().getGeocodeFromUrl("http://www.coord.info/GC12ABC")); + assertEquals("GC12ABC", GCConnector.getInstance().getGeocodeFromUrl("http://www.geocaching.com/geocache/GC12ABC_die-muhlen-im-schondratal-muhle-munchau")); + assertEquals("GC12ABC", GCConnector.getInstance().getGeocodeFromUrl("http://geocaching.com/geocache/GC12ABC_die-muhlen-im-schondratal-muhle-munchau")); + + assertNull(GCConnector.getInstance().getGeocodeFromUrl("http://coord.info/TB1234")); + assertNull(GCConnector.getInstance().getGeocodeFromUrl("http://www.coord.info/TB1234")); } } diff --git a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java index 43b6d01..1509563 100644 --- a/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java +++ b/tests/src/cgeo/geocaching/connector/gc/GCParserTest.java @@ -56,6 +56,8 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase { assertNotNull(result); assertEquals(1, result.getCount()); final Geocache cache = result.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB); + assertNotNull(cache); + assert (cache != null); // eclipse bug assertEquals(cacheName, cache.getName()); } @@ -158,6 +160,8 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase { cache.drop(new Handler()); final String page = GCParser.requestHtmlPage(cache.getGeocode(), null, "n", "0"); final Geocache cache2 = GCParser.parseCacheFromText(page, null).getFirstCacheFromResult(LoadFlags.LOAD_CACHE_ONLY); + assertNotNull(cache2); + assert (cache2 != null); // eclipse bug assertTrue(cache2.hasUserModifiedCoords()); assertEquals(new Geopoint("N51 21.544", "E07 02.566"), cache2.getCoords()); // delete coordinates @@ -165,6 +169,8 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase { cache2.drop(new Handler()); final String page2 = GCParser.requestHtmlPage(cache.getGeocode(), null, "n", "0"); final Geocache cache3 = GCParser.parseCacheFromText(page2, null).getFirstCacheFromResult(LoadFlags.LOAD_CACHE_ONLY); + assertNotNull(cache3); + assert (cache3 != null); // eclipse bug assertFalse(cache3.hasUserModifiedCoords()); } @@ -172,9 +178,10 @@ public class GCParserTest extends AbstractResourceInstrumentationTestCase { cache.setPersonalNote(note); cache.setWaypoints(new ArrayList<Waypoint>(), false); cache.parseWaypointsFromNote(); - assertEquals(expected.length, cache.getWaypoints().size()); + final List<Waypoint> waypoints = cache.getWaypoints(); + assertEquals(expected.length, waypoints.size()); for (int i = 0; i < expected.length; i++) { - assertTrue(expected[i].equals(cache.getWaypoint(i).getCoords())); + assertTrue(expected[i].equals(waypoints.get(i).getCoords())); } } diff --git a/tests/src/cgeo/geocaching/connector/trackable/GeokretyConnectorTest.java b/tests/src/cgeo/geocaching/connector/trackable/GeokretyConnectorTest.java index f08fb6b..d3633cb 100644 --- a/tests/src/cgeo/geocaching/connector/trackable/GeokretyConnectorTest.java +++ b/tests/src/cgeo/geocaching/connector/trackable/GeokretyConnectorTest.java @@ -11,4 +11,17 @@ public class GeokretyConnectorTest extends TestCase { assertFalse(new GeokretyConnector().canHandleTrackable("UNKNOWN")); } + public static void testGetTrackableCodeFromUrl() throws Exception { + assertEquals("GK78FA", new GeokretyConnector().getTrackableCodeFromUrl("http://www.geokrety.org/konkret.php?id=30970")); + assertEquals("GK78FA", new GeokretyConnector().getTrackableCodeFromUrl("http://geokrety.org/konkret.php?id=30970")); + } + + public static void testGeocode() throws Exception { + assertEquals("GK97C1", GeokretyConnector.geocode(38849)); + } + + public static void testGetId() throws Exception { + assertEquals(38849, GeokretyConnector.getId("GK97C1")); + } + } diff --git a/tests/src/cgeo/geocaching/connector/trackable/TravelBugConnectorTest.java b/tests/src/cgeo/geocaching/connector/trackable/TravelBugConnectorTest.java index ef2821d..7e85b71 100644 --- a/tests/src/cgeo/geocaching/connector/trackable/TravelBugConnectorTest.java +++ b/tests/src/cgeo/geocaching/connector/trackable/TravelBugConnectorTest.java @@ -38,4 +38,15 @@ public class TravelBugConnectorTest extends TestCase { private static TravelBugConnector getConnector() { return TravelBugConnector.getInstance(); } + + public static void testGetTrackableCodeFromUrl() throws Exception { + assertEquals("TB1234", TravelBugConnector.getInstance().getTrackableCodeFromUrl("http://coord.info/TB1234")); + assertEquals("TB1234", TravelBugConnector.getInstance().getTrackableCodeFromUrl("http://www.coord.info/TB1234")); + assertEquals("TB1234", TravelBugConnector.getInstance().getTrackableCodeFromUrl("http://geocaching.com/track/details.aspx?tracker=TB1234")); + assertEquals("TB1234", TravelBugConnector.getInstance().getTrackableCodeFromUrl("http://www.geocaching.com/track/details.aspx?tracker=TB1234")); + + // do not match coord.info URLs of caches + assertNull(TravelBugConnector.getInstance().getTrackableCodeFromUrl("http://coord.info/GC1234")); + assertNull(TravelBugConnector.getInstance().getTrackableCodeFromUrl("http://www.coord.info/GC1234")); + } } diff --git a/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java b/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java index 54db279..d126c0b 100644 --- a/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java +++ b/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java @@ -25,7 +25,7 @@ public class CacheAttributeTest extends AndroidTestCase { public static void testGetL10n() { final CacheAttribute attribute = CacheAttribute.HIKING; - // This test is language dependend. It does not make sense to test it + // This test is language dependent. It does not make sense to test it // with every attribute. We just want to know if getL10n works // correctly assertFalse("_yes and _no must not have the same translation", @@ -37,7 +37,6 @@ public class CacheAttributeTest extends AndroidTestCase { assertTrue("Test cannot be run with this attribute", attribute.gcid >= 0); assertTrue("Test cannot be run with this attribute", attribute.ocacode >= 0); assertSame(CacheAttribute.getByRawName(attribute.rawName), attribute); - assertSame(CacheAttribute.getByGcId(attribute.gcid), attribute); assertSame(CacheAttribute.getByOcACode(attribute.ocacode), attribute); } diff --git a/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java b/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java index 2f11dfc..26a1953 100644 --- a/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java +++ b/tests/src/cgeo/geocaching/enumerations/CacheSizeTest.java @@ -30,8 +30,6 @@ public class CacheSizeTest extends AndroidTestCase { public static void testGetByIdNumeric() { assertEquals(CacheSize.REGULAR, CacheSize.getById("3")); - assertEquals(CacheSize.UNKNOWN, CacheSize.getById("0")); - assertEquals(CacheSize.UNKNOWN, CacheSize.getById("9")); assertEquals(CacheSize.UNKNOWN, CacheSize.getById("-1")); } } diff --git a/tests/src/cgeo/geocaching/enumerations/LogTypeTest.java b/tests/src/cgeo/geocaching/enumerations/LogTypeTest.java index 81ca33b..47879a0 100644 --- a/tests/src/cgeo/geocaching/enumerations/LogTypeTest.java +++ b/tests/src/cgeo/geocaching/enumerations/LogTypeTest.java @@ -17,8 +17,7 @@ public class LogTypeTest extends AndroidTestCase { } public static void testGetByType() { - assertEquals(LogType.UNKNOWN, LogType.getByIconName("")); - assertEquals(LogType.UNKNOWN, LogType.getByIconName(null)); + assertEquals(LogType.UNKNOWN, LogType.getByType("obviously unknown type")); assertEquals(LogType.GRABBED_IT, LogType.getByType("grabbed it")); assertEquals(LogType.GRABBED_IT, LogType.getByType(" gRAbbed IT ")); } diff --git a/tests/src/cgeo/geocaching/enumerations/LogTypeTrackableTest.java b/tests/src/cgeo/geocaching/enumerations/LogTypeTrackableTest.java index 667eefb..d6b7d33 100644 --- a/tests/src/cgeo/geocaching/enumerations/LogTypeTrackableTest.java +++ b/tests/src/cgeo/geocaching/enumerations/LogTypeTrackableTest.java @@ -1,11 +1,15 @@ package cgeo.geocaching.enumerations; +import org.apache.commons.lang3.StringUtils; + import android.test.AndroidTestCase; public class LogTypeTrackableTest extends AndroidTestCase { public static void testFindById() { - assertEquals(LogTypeTrackable.DO_NOTHING, LogTypeTrackable.findById(12345)); + for (LogTypeTrackable logTypeTrackable : LogTypeTrackable.values()) { + assertTrue(StringUtils.isNotEmpty(logTypeTrackable.getLabel())); + } } } diff --git a/tests/src/cgeo/geocaching/export/ExportTest.java b/tests/src/cgeo/geocaching/export/ExportTest.java index b8f1ffd..b03c9bb 100644 --- a/tests/src/cgeo/geocaching/export/ExportTest.java +++ b/tests/src/cgeo/geocaching/export/ExportTest.java @@ -20,9 +20,9 @@ public class ExportTest extends CGeoTestCase { final Geocache cache = new Geocache(); cache.setGeocode("GCX1234"); final LogEntry log = new LogEntry(1353244820000L, LogType.FOUND_IT, "Hidden in a tree"); - final StringBuilder logStr = new StringBuilder(); - FieldnoteExport.appendFieldNote(logStr, cache, log); - assertEquals("Non matching export " + logStr.toString(), "GCX1234,2012-11-18T13:20:20Z,Found it,\"Hidden in a tree\"\n", logStr.toString()); + FieldNotes fieldNotes = new FieldNotes(); + fieldNotes.add(cache, log); + assertEquals("Non matching export " + fieldNotes.getContent(), "GCX1234,2012-11-18T13:20:20Z,Found it,\"Hidden in a tree\"\n", fieldNotes.getContent()); } public static void testGpxExportSmilies() throws InterruptedException, ExecutionException { diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java index dcaad22..9297819 100644 --- a/tests/src/cgeo/geocaching/files/GPXParserTest.java +++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java @@ -325,4 +325,27 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase { assertEquals("Wasserleitung", cache.getHint()); } + private Geocache getFirstCache(int gpxResourceId) throws IOException, ParserException { + final List<Geocache> caches = readGPX10(gpxResourceId); + assertNotNull(caches); + assertEquals(1, caches.size()); + final Geocache cache = caches.get(0); + return cache; + } + + public void testGsakFavPoints() throws IOException, ParserException { + final Geocache cache = getFirstCache(R.raw.gc3t1xg_gsak); + assertEquals(258, cache.getFavoritePoints()); + } + + public void testGsakPersonalNote() throws IOException, ParserException { + final Geocache cache = getFirstCache(R.raw.gc3t1xg_gsak); + assertEquals("Personal Note Test", cache.getPersonalNote()); + } + + public void testGsakPremium() throws IOException, ParserException { + final Geocache cache = getFirstCache(R.raw.gc3t1xg_gsak); + assertTrue(cache.isPremiumMembersOnly()); + } + } diff --git a/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java b/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java index 1de2e26..28dbe77 100644 --- a/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java +++ b/tests/src/cgeo/geocaching/geopoint/GeoPointParserTest.java @@ -19,7 +19,13 @@ public class GeoPointParserTest extends AndroidTestCase { public static void testFullCoordinates() { final Geopoint goal = new Geopoint(refLatitude, refLongitude); - assertTrue(goal.isEqualTo(GeopointParser.parse("N 49° 56.031 | E 8° 38.564"), 1e-6)); + assertEquals(goal, GeopointParser.parse("N 49° 56.031 | E 8° 38.564"), 1e-6); + } + + private static void assertEquals(final Geopoint expected, Geopoint actual, double tolerance) { + assertNotNull(expected); + assertNotNull(actual); + assertTrue(expected.distanceTo(actual) <= tolerance); } public static void testCoordinateMissingPart() { @@ -48,18 +54,18 @@ public class GeoPointParserTest extends AndroidTestCase { public static void testVariousFormats() { final Geopoint goal1 = GeopointParser.parse("N 49° 43' 57\" | E 2 12' 35"); final Geopoint goal2 = GeopointParser.parse("N 49 43.95 E2°12.5833333333"); - assertTrue(goal1.isEqualTo(goal2, 1e-6)); + assertEquals(goal1, goal2, 1e-6); } public static void testParseOurOwnSeparator() { final Geopoint separator = GeopointParser.parse("N 49° 43' 57\"" + Formatter.SEPARATOR + "E 2 12' 35"); final Geopoint noSeparator = GeopointParser.parse("N 49 43.95 E2°12.5833333333"); - assertTrue(separator.isEqualTo(noSeparator, 1e-6)); + assertEquals(separator, noSeparator, 1e-6); } public static void testInSentence() { final Geopoint p1 = GeopointParser.parse("Station3: N51 21.523 / E07 02.680"); - final Geopoint p2 = GeopointParser.parse("N51 21.523", "E07 02.680"); + final Geopoint p2 = GeopointParser.parse("N51 21.523 E07 02.680"); assertNotNull(p1); assertNotNull(p2); assertEquals(p1, p2); @@ -106,6 +112,6 @@ public class GeoPointParserTest extends AndroidTestCase { } public static void testEquatorMeridian() { - assertEquals(new Geopoint(0, 0), GeopointParser.parse("00° 00.000 00° 00.000")); + assertEquals(Geopoint.ZERO, GeopointParser.parse("00° 00.000 00° 00.000")); } } diff --git a/tests/src/cgeo/geocaching/geopoint/ViewportTest.java b/tests/src/cgeo/geocaching/geopoint/ViewportTest.java index 60766b4..11f78ad 100644 --- a/tests/src/cgeo/geocaching/geopoint/ViewportTest.java +++ b/tests/src/cgeo/geocaching/geopoint/ViewportTest.java @@ -2,6 +2,8 @@ package cgeo.geocaching.geopoint; import cgeo.geocaching.ICoordinates; +import org.eclipse.jdt.annotation.NonNull; + import android.test.AndroidTestCase; import java.util.Collections; @@ -11,7 +13,8 @@ import java.util.Set; public class ViewportTest extends AndroidTestCase { - final private static Viewport vpRef = new Viewport(new Geopoint(-1.0, -2.0), new Geopoint(3.0, 4.0)); + final private static @NonNull + Viewport vpRef = new Viewport(new Geopoint(-1.0, -2.0), new Geopoint(3.0, 4.0)); public static void assertBounds(final Viewport vp) { assertEquals(new Geopoint(1.0, 1.0), vp.center); @@ -49,7 +52,7 @@ public class ViewportTest extends AndroidTestCase { public static void testInViewport() { assertFalse(vpRef.contains(new Geopoint(-2.0, -2.0))); assertFalse(vpRef.contains(new Geopoint(4.0, 4.0))); - assertTrue(vpRef.contains(new Geopoint(0.0, 0.0))); + assertTrue(vpRef.contains(Geopoint.ZERO)); assertTrue(vpRef.contains(new Geopoint(-1.0, -2.0))); assertTrue(vpRef.contains(new Geopoint(3.0, 4.0))); } @@ -86,16 +89,6 @@ public class ViewportTest extends AndroidTestCase { assertFalse(vpRef.includes(vpRef.resize(2.0))); } - public static void testExpands() { - assertEquals(vpRef, vpRef.expand(new Geopoint(0, 0))); - final Viewport vp1 = vpRef.expand(new Geopoint(-4.0, 0.0)); - assertEquals(new Geopoint(-4.0, -2.0), vp1.bottomLeft); - assertEquals(new Geopoint(3.0, 4.0), vp1.topRight); - final Viewport vp2 = vpRef.expand(new Geopoint(-10.0, 10.0)); - assertEquals(new Geopoint(-10.0, -2.0), vp2.bottomLeft); - assertEquals(new Geopoint(3.0, 10.0), vp2.topRight); - } - public static void testContaining() { assertNull(Viewport.containing(Collections.singleton((ICoordinates) null))); final Set<Geopoint> points = new HashSet<Geopoint>(); diff --git a/tests/src/cgeo/geocaching/network/OAuthTest.java b/tests/src/cgeo/geocaching/network/OAuthTest.java index fa0104f..6888cec 100644 --- a/tests/src/cgeo/geocaching/network/OAuthTest.java +++ b/tests/src/cgeo/geocaching/network/OAuthTest.java @@ -1,5 +1,7 @@ package cgeo.geocaching.network; +import org.eclipse.jdt.annotation.NonNull; + import java.util.ArrayList; import java.util.List; @@ -26,7 +28,8 @@ public class OAuthTest extends TestCase { public static void testUnreservedCharactersMustNotBeEncoded() { for (Character c : UNRESERVED) { - final String charAsString = String.valueOf(c); + final @NonNull + String charAsString = String.valueOf(c); assertEquals("wrong OAuth encoding for " + c, charAsString, OAuth.percentEncode(charAsString)); } } @@ -35,7 +38,8 @@ public class OAuthTest extends TestCase { for (int i = 32; i < 127; i++) { final Character c = (char) i; if (!UNRESERVED.contains(c)) { - final String charAsString = String.valueOf(c); + final @NonNull + String charAsString = String.valueOf(c); final String encoded = OAuth.percentEncode(charAsString); assertFalse("Character '" + charAsString + "' not encoded", charAsString.equals(encoded)); assertTrue(encoded.startsWith("%")); diff --git a/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java b/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java index 2db3f59..0cfee49 100644 --- a/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java +++ b/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java @@ -20,7 +20,7 @@ public class DistanceComparatorTest extends AndroidTestCase { } caches.add(cache); } - Collections.sort(caches, new DistanceComparator(new Geopoint(0, 0), caches)); + Collections.sort(caches, new DistanceComparator(Geopoint.ZERO, caches)); } } diff --git a/tests/src/cgeo/geocaching/utils/LogTemplateProviderTest.java b/tests/src/cgeo/geocaching/utils/LogTemplateProviderTest.java index 5911218..249cbb1 100644 --- a/tests/src/cgeo/geocaching/utils/LogTemplateProviderTest.java +++ b/tests/src/cgeo/geocaching/utils/LogTemplateProviderTest.java @@ -10,11 +10,11 @@ public class LogTemplateProviderTest extends TestCase { public static void testApplyTemplates() { final String noTemplates = " no templates "; - assertEquals(noTemplates, LogTemplateProvider.applyTemplates(noTemplates, new LogContext(true))); + assertEquals(noTemplates, LogTemplateProvider.applyTemplates(noTemplates, new LogContext(null, null, true))); // This test can occasionally fail if the current year changes right after the next line. final String currentYear = Integer.toString(Calendar.YEAR); - assertTrue(LogTemplateProvider.applyTemplates("[DATE]", new LogContext(true)).contains(currentYear)); + assertTrue(LogTemplateProvider.applyTemplates("[DATE]", new LogContext(null, null, true)).contains(currentYear)); } } diff --git a/tests/src/cgeo/geocaching/utils/MemorySubjectTest.java b/tests/src/cgeo/geocaching/utils/MemorySubjectTest.java deleted file mode 100644 index ee46950..0000000 --- a/tests/src/cgeo/geocaching/utils/MemorySubjectTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package cgeo.geocaching.utils; - -import android.test.AndroidTestCase; - -public class MemorySubjectTest extends AndroidTestCase { - - private static class Observer implements IObserver<Integer> { - private int times = 0; - private Integer value; - - @Override - public void update(final Integer data) { - value = data; - times++; - } - } - - private Observer observer; - private MemorySubject<Integer> memorySubject; - - @Override - public void setUp() throws Exception { - super.setUp(); - observer = new Observer(); - memorySubject = new MemorySubject<Integer>(); - } - - public void testInitial() { - assertNull(observer.value); - assertEquals(0, observer.times); - assertNull(memorySubject.getMemory()); - } - - public void testMemory() { - memorySubject.addObserver(observer); - memorySubject.notifyObservers(10); - assertEquals(Integer.valueOf(10), observer.value); - assertEquals(1, observer.times); - assertEquals(Integer.valueOf(10), memorySubject.getMemory()); - memorySubject.notifyObservers(20); - assertEquals(Integer.valueOf(20), observer.value); - assertEquals(2, observer.times); - assertEquals(Integer.valueOf(20), memorySubject.getMemory()); - } - - public void testAttach() { - memorySubject.notifyObservers(10); - assertNull(observer.value); - assertEquals(0, observer.times); - memorySubject.addObserver(observer); - assertEquals(Integer.valueOf(10), observer.value); - assertEquals(1, observer.times); - memorySubject.notifyObservers(20); - assertEquals(Integer.valueOf(20), observer.value); - assertEquals(2, observer.times); - } - - public void testDetach() { - memorySubject.addObserver(observer); - memorySubject.notifyObservers(10); - assertEquals(Integer.valueOf(10), observer.value); - assertEquals(1, observer.times); - assertEquals(Integer.valueOf(10), memorySubject.getMemory()); - memorySubject.deleteObserver(observer); - memorySubject.notifyObservers(20); - assertEquals(Integer.valueOf(10), observer.value); - assertEquals(1, observer.times); - assertEquals(Integer.valueOf(20), memorySubject.getMemory()); - } - - public void testMultiple() { - final Observer otherObserver = new Observer(); - memorySubject.addObserver(otherObserver); - testDetach(); - assertEquals(Integer.valueOf(20), otherObserver.value); - assertEquals(2, otherObserver.times); - } - -} |
