Closed N-Lin closed 10 years ago
I've reviewed the code and have found a number of points which could do with changing (see below). I have focused on the actual code, and Jane is going to look at the comments. There are quite a lot of comments, but most of them are fairly minor, and this is a big commit so it's to be expected. Once you have addressed these issues and anything which Jane highlights, you should just push another commit to your master branch. That should (hopefully) update the pull request without us needed to open a new one. Add to this conversation if you have any questions/issues. Comments follow:
117: An exception is thrown here (as expected), so the statements at lines 119, 121, and 123 are not tested at all.
testCurvlinearCoords: lon_data and lon_values should be named so that it is obvious which one is the expected values and which is the data values
178: cellList, not celllist
200-204: This isn't used anywhere
83-86: This isn't true because it's traditional, it's true because that's what's in the underlying data
221-224: These statements don't test much - afterApplyPlugin just uses exactly the same code as is called in dataset.addVariablePlugin(), plus they are in a loop but don't depend on the loop at all. These lines as well as line 198 should be removed.
231-232: You should calculate these expected values, not use the plugin to do it (since you are trying to test the plugin)
testReturnEmptyTimeseriesFeatures: Also, it's better to use loops such as for(GridCell2D cell : samplePoints) - there's no need to use an index and get(i).
testMapFeaturesWithWrongParams(): This throws an exception (as expected) at line 346, so the test stops there on the first loop. Nothing below line 347 is tested in this method. Also use cell.getCentre() as a target point instead of a BoundingBox
testMapFeatures(): Use cell.getCentre() in PlottingDomainParams, not cell.getFootprint(). Needs more comments
testTimeSeriesFeatures(): cell.getCentre(), not cell.getFootprint() again.
getFeatureByZExtent(): needs comments, it's not obvious what this does
Should be using cell.getCentre() as the target horizontal position rather than cell.getFootprint() for the BoundingBox in PlottingDomainParams on lines: 211, 297, 312, etc. Search cell.getFootprint() in the code to find them all.
858: This is only true for lat/lon grids. That's fine because that's all that's being tested, but you need to specify this in the documentation
Why have you committed this? It is a minor (and incorrect) change to formatting.
Unused imports, unused variable. Remove all compiler warnings before committing code. The rest of this class we can review once you have re-implemented the testIterator method, but that can be in the next pull request (i.e. don't worry about it for this review)
31: Incorrect documentation link
This should test some ISOChronology times, and it would be helpful to say why assert statements should fail (e.g. 29th Feb is not present in a NoLeapChronology)
Could do with more comments on why asserts should be true/false
Remove main method
61-62: Make these private
43, 69, 90, etc.: Incorrect spelling - reference doesn't work
testIsAscending(): Needs to test a case that is false
140: Never gets tested, as line 139 throws exception
Should be merged with TimeAxisTest.
testIsAscending(): Should test a non-ascending axis too.
testIsAscending(): Should test a non-ascending axis too.
Needs to test that set fails (i.e. it really is immutable).
114: Never executed as previous line throws exception
testGetTimeRangeForString: Needs to test some non-UTC strings
Evenin' all :) The javadoc and commenting in this bunch is miles better - good effort - so all the points below are where things heve just been missed out. I'm looking at it from the genuine point of view of not really knowing what's going on! Therefore, if I can't understand it, then someone else won't either.
Here's the list (sorry!)
General: capitalise sentence starts :) Most setUp() methods have no details (Domain1DMapperTest and LineStringTest are exceptions to this and are good examples of providing details). Some methods have really helpful inline comments, but many, including where there is no javadoc, don't have this to help either.
CurviLinearGridDatasetTest.java testCurviLinearCoords() no javadoc for what this method is doing testCurviLinearDataset() ditto, and you've also got a question - is it rhetorical or have you sorted it out?
RangeListTest.java static method - javadoc doesn't say that it throws ExceptionInInitializerError() test() - should there be some javadoc?
RectiLinearGridDatasetTest.java testTimeSerieFeatures() "purposedly" isn't a word!!! and you probably mean "corresponding" rather than "responding" (which is 'to reply')! testTimeSerieFeaturesPartofZExents() 'inside' and 'outside' do not use the preposition 'of'. readFeatureTest() could do with a little more explanation
Domain1DMapperTest.java setUp() has some commented out code towards the bottom - is it needed?
PRTreeFeatureIndexerTest.java "points number..." -> "number of points..." testgetAllFeatureIds() - no javadoc testFindFeatureIds() - javadoc findFeatureIds() - it says it does the real business of testing... details?
MapDoaminImplTest.java This needs to be renamed - '..Domain..' !
SimpleGridDomainTest.java setUp() - no javadoc even though it may throw an exception. testContains() - no javadoc, provide some info on how you've chosen the values to test and why they're useful.
SimpleHorizontalDomainTest.java testContains() - no javadoc, again, some info on the choice of values.
SimpleTemporaDomainTest.java This needs to be renamed - '..Temporal..' ! testContains() - no javadoc
SimpleVerticalCrsImplTest.java testContain() - no javadoc, again, some info on the choice of values.
TrajectoryDomainTest.java testContains() - no javadoc, again, some info on the choice of values.
GridFeatureTest.java no javadoc
BoundingBoxImplTest.java testContains() - javadoc, value choices
LineStringTest.java testGetPointsOnPath() - javadoc - but HOW is it being tested? testgGetFractionalControlPointDistance() - javadoc - ditto
GridCell2DImplTest.java testContains() - javadoc insufficient testGetFoorprint() - javadoc insufficient, do you mean 'footprint'?
RectilinearGridImplTest.java javadoc insufficient throughout - HOW is it being tested? and choices of values
ReferenceableAxisImplTest.java javadoc insufficient throughout - HOW is it being tested? and choices of values
RegularAxisImplTest.java javadoc insufficient (except last 2 methods) - HOW is it being tested? and choices of values
RegularGridImplTest.java regularGridImplTest() - javadoc insufficient - HOW is it being tested? and choices of values
SimpleGridCell4DTest.java testContains() - javadoc insufficient - HOW is it being tested? and choices of values
TimeAxisImplTest.java javadoc insufficient throughout - HOW is it being tested? and choices of values
TimeAxisTest.java there's no javadoc at all in this one!!!
VerticalAxisImplTest.java javadoc insufficient throughout - HOW is it being tested? and choices of values, inline comments good though.
AbstractImmutableArrayTest.java test descriptions in the wrong place - just need moving
ColletionUtilsTest.java This needs to be renamed - '..Collection..' ! javadoc insufficient on all methods
ExtentsTest.java javadoc insufficient throughout - HOW is it being tested? and choices of values
GISUtilsTest.java javadoc insufficient throughout - HOW is it being tested? and choices of values
ImmutableArrayTest.java javadoc insufficient
TimeUtilsTest.java javadoc insufficient throughout - HOW is it being tested? and choices of values
ValuesArray2DTest.java javadoc insufficient throughout - HOW is it being tested? and choices of values
Closing, since Nan has opened a new pull request for the latest changes instead.
You may postpone the merge as Domain1Dmapper needs to be write again.