Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert from groovy to junit #1189

Merged
merged 3 commits into from
Jun 2, 2023

Conversation

cssjessica
Copy link
Contributor

@cssjessica cssjessica commented May 30, 2023

Description of Changes

The following spock groovy test were converted to Junit: PointStreamSpec and Nc4IospSpec from Issue #1188.

PR Checklist

  • Link to any issues that the PR addresses
  • Add labels
  • Open as a draft PR
    until ready for review
  • Make sure GitHub tests pass
  • Mark PR as "Ready for Review"

@CLAassistant
Copy link

CLAassistant commented May 30, 2023

CLA assistant check
All committers have signed the CLA.


File outFile = temporaryFolder.newFile();
try (FeatureDatasetPoint fdPoint =
(FeatureDatasetPoint) FeatureDatasetFactoryManager.open(FeatureType.ANY_POINT, location, null)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is deprecated, the new method signature takes and error log formatter (which can just be null for the sake of using the current API). This test also then won't throw the NoFactoryFoundException

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method was updated.

// Ignore this class's tests if NetCDF-4 isn't present.
// We're using setup() because it shows these tests as being ignored.
// setupSpec() shows them as *non-existent*, which is not what we want.
Assume.assumeTrue("NetCDF-4 C library not present.", Nc4Iosp.isClibraryPresent());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we still need to check that the C library is present for these tests. You can follow what this test does: https://github.com/Unidata/tds/blob/13017bd6dfd9f5ae270bf2e524d8d7340592742b/tds/src/test/java/thredds/server/ncss/view/dsg/DsgSubsetWriterTest.java#L47

Copy link
Member

@tdrwenski tdrwenski May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand the comment correctly they wanted the tests to be ignored if the C Library isn't present. But these tests just test that no exception is thrown when a method is called, which should be the case whether or not the library exists, so I don't think that assumption is really needed

Copy link

@haileyajohnson haileyajohnson May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, what are these even meant to be testing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding was that at some point if you didn't have the netcdf-c library present then calling these functions caused a null pointer exception. Then they made these tests and added a null check to fix that. So they only check that there is no null pointer exception thrown, but yeah not the most useful tests of all time 😆

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol well now they don't do anything cuz the functions return right away 🤷

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it's not a super useful test... do you still want to check for the c library or leave as is?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We ended up adding the check for the C library

@haileyajohnson haileyajohnson merged commit e5dd4f6 into Unidata:maint-5.x Jun 2, 2023
@cssjessica cssjessica deleted the test_refactor branch June 2, 2023 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants