Fix/invalid polygons#213
Open
marcos-lg wants to merge 3 commits into
Open
Conversation
MattBlissett
requested changes
Jul 17, 2026
| // API no longer throws an exception here. | ||
| public void testBadConstructor1() { | ||
| new WithinPredicate("POLYGON"); | ||
| assertNoGeometryWarnings(); |
Member
There was a problem hiding this comment.
Shouldn't this be asserting that there is a warning?
It logs one:
14:31:01.797 [main] WARN org.gbif.api.model.predicate.WithinPredicate -- Invalid geometry string POLYGON: Cannot parse simple WKT: POLYGON Expected [(] found EOF
| // API no longer throws an exception here. | ||
| public void testBadRectangle() { | ||
| new WithinPredicate("POLYGON ((30 10, 100 100, 20 40, 40 40, 30 10))"); | ||
| assertNoGeometryWarnings(); |
| public void testOldDownload() { | ||
| // A polygon that is no longer valid should still be read. | ||
| new WithinPredicate("POLYGON((179.99706 50.42798,175.71729 50.32125,164.69551 54.46408,164.41784 58.23259,152.93250 62.42883,149.28338 61.42635,145.49908 63.19071,135.05338 62.47747,121.47856 63.88828,118.42940 61.72106,92.03338 63.48794,88.04893 65.83859,72.38348 64.83205,35.10765 65.27235,20.53798 66.27026,15.93477 63.64430,13.23228 64.16949,14.02329 66.20159,-3.98112 66.35560,-5.28656 60.41050,-24.62696 63.13864,-26.61983 66.37187,-35.26608 65.57732,-42.55152 58.69327,-51.84071 58.60134,-55.81483 49.91863,-85.07522 48.86776,-87.99834 53.35866,-109.22832 59.11742,-121.84178 55.37470,-134.08814 63.56701,-141.82291 64.54874,-141.93138 68.24804,-158.60607 65.39087,-150.05958 56.55879,-167.23505 51.12098,-180.00299 50.42801,-180.00000 90.00000,180.00000 90.00000,179.99706 50.42798))"); | ||
| assertNoGeometryWarnings(); |
Member
There was a problem hiding this comment.
And here, if the test is enabled again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work for gbif/occurrence#529
I changed some tests because some polygons that were considered invalid they work in the new portal now so I guess we have to accept them. Also there is a test with an old polygon that doesn't pass the WKTReader parsing anymore.
The WithinPredicateTest was outdated because the WithinPredicate constructor doesn't throw an exception anymore so that test was passing but some polygons were actually failing the validation.