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

Added unit test cases for Preflight Controller #422

Closed
wants to merge 2 commits into from
Closed

Added unit test cases for Preflight Controller #422

wants to merge 2 commits into from

Conversation

shlokam
Copy link

@shlokam shlokam commented Oct 18, 2022

Attempts to fix #399

@shlokam
Copy link
Author

shlokam commented Oct 18, 2022

Can you please let me know why the pipeline failed?

@preetkaran20
Copy link
Member

preetkaran20 commented Oct 18, 2022

Can you please let me know why the pipeline failed?

Hi, you need to run ./gradlew spotlessApply locally

import java.io.InputStream;


public class FileReader {
Copy link
Member

@preetkaran20 preetkaran20 Oct 18, 2022

Choose a reason for hiding this comment

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

I think you have created this class such that you can mock the readAsStream functionality right?
I think you don't need a different class, create a spy of PreflightController in test class and a method in PreflightController which you can mock using spy and everything else will work perfectly.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that was the purpose for the class.
Ok. I will make the changes.

public class PreflightControllerTest {

@Mock
UnrestrictedFileUpload unrestrictedFileUpload;
Copy link
Member

Choose a reason for hiding this comment

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

add private.

Copy link
Author

Choose a reason for hiding this comment

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

Ok

@shlokam shlokam closed this by deleting the head repository Dec 16, 2022
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.

Add unit tests for FileUpload Vulnerability
2 participants