Skip to content

Remove PowerMock from the Slack GCF sample. #3186

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

Merged
merged 4 commits into from
Jun 18, 2020

Conversation

saturnism
Copy link
Contributor

@saturnism saturnism commented Jun 17, 2020

Cherry-picked and rebased from @eamonnmcmanus's #2854

Instead of using Whitebox, use package-private constructor overloads
to supply the values needed by the test.

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • API's need to be enabled to test (tell us)
  • Environment Variables need to be set (ask us to set them)
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only
  • Please merge this PR for me once it is approved.

Instead of using Whitebox, use package-private constructor overloads
to supply the values needed by the test.
@saturnism saturnism requested a review from a team June 17, 2020 16:57
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 17, 2020
@lesv
Copy link
Contributor

lesv commented Jun 17, 2020

@saturnism Looks like there are both Lint issues and Java 11.
Please follow the suggestions in the template at the top.
Tests pass: mvn clean verify required
Lint passes: mvn -P lint checkstyle:check required
Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only

@saturnism
Copy link
Contributor Author

there is NPE from the tests during local run. any tricks to get the test running locally?

@saturnism
Copy link
Contributor Author

Lint passes: mvn -P lint checkstyle:check required
Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only

any way to simply add these into the compile phase, or add a profile to run these easily?

@saturnism
Copy link
Contributor Author

also, i don't think those tests passed in the past. I'm getting

[ERROR] This use of java/util/logging/Logger.warning(Ljava/lang/String;)V might be used to include CRLF characters into log messages [functions.SlackSlashCommand] At SlackSlashCommand.java:[line 70] CRLF_INJECTION_LOGS

This line was not changed in the PR.

[ERROR] Class functions.SlackSlashCommand does not implement a toString method [functions.SlackSlashCommand] At SlackSlashCommand.java:[lines 40-210] IMC_IMMATURE_CLASS_NO_TOSTRING

Why does this class needs a ToString?

@saturnism
Copy link
Contributor Author

saturnism commented Jun 17, 2020

need SLACK_TEST_SIGNATURE to test locally w/ verify. A unit test shouldn't depend on external values this way.

I think we also need KG_API_KEY and SLACK_SECRET.

@ace-n
Copy link
Contributor

ace-n commented Jun 17, 2020

@saturnism followed up internally, check your email. 🙂

@saturnism
Copy link
Contributor Author

Static Analysis failed with:

[ERROR] COMPILATION ERROR :
[ERROR] javac: invalid target release: 11

@lesv
Copy link
Contributor

lesv commented Jun 17, 2020

you can ignore static analysis, but not lint.

@saturnism
Copy link
Contributor Author

@lesv all tests passing. i think there is a problem w/ the static analysis check due to jdk version. please merge, thnx!

@lesv
Copy link
Contributor

lesv commented Jun 18, 2020

That makes sense - we'll update that too.

@lesv lesv merged commit a3453bf into GoogleCloudPlatform:master Jun 18, 2020
@saturnism saturnism deleted the eaamon-mockito3 branch June 18, 2020 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants