Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tests for rest calls#125

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

Weltraumschaf
Copy link
Member

@WeltraumschafWeltraumschaf commentedMar 7, 2024
edited
Loading

This PR adds capture and replay integration tests for all generic services.

Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
@WeltraumschafWeltraumschaf marked this pull request as draftMarch 7, 2024 20:50
@WeltraumschafWeltraumschaf self-assigned thisMar 7, 2024
@WeltraumschafWeltraumschaf added the enhancementNew feature or request labelMar 7, 2024
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Since package is always same, so we can resolve the whole path inthe base class.Also put the context information in file name at the end, so thatfixtures show up near the test class in the IDE.Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Also fix wrong JSON property mapping.Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
…ethodsSigned-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
@WeltraumschafWeltraumschafforce-pushed thetests_for_rest_calls branch 3 times, most recently from66515d3 to4f4e3c9CompareMarch 14, 2024 14:22
Also introduce some defaults to models which came from DefectDojo:We had some fields null by default which will be empty string/arrayby default in DefectDojo responses.Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
The structure of code should be ordered, so that the more abstractAPI is at the top and the more nitty gritty details are below. Thishas the advantage that one interested in an quick overview need notto scroll up and down. You only need to scroll down for details.Also add some null-checks and missing API doc.Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
@WeltraumschafWeltraumschaf marked this pull request as ready for reviewMarch 14, 2024 20:20
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
Copy link
Member

@IlyesbdlalaIlyesbdlala left a comment

Choose a reason for hiding this comment

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

Have a couple of questions, but LGTM.

@@ -10,7 +10,7 @@
import io.securecodebox.persistence.defectdojo.model.PaginatedResult;
import io.securecodebox.persistence.defectdojo.model.ProductType;

public class ProductTypeService extends GenericDefectDojoService<ProductType> {
publicfinalclass ProductTypeService extends GenericDefectDojoService<ProductType> {
Copy link
Member

Choose a reason for hiding this comment

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

What is the reasoning behind making the class final ?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This is a general advice to make API as private and immutable as possible to avoid accidental missuse. I make classes in general package private and final. Only, and only if, I later encounter that it is necessary to open such contraints, I do this explicitly. This practice helps me to avoid accidental complexity (e.g. inheritance hell).

Another example – not relevant for this particular example because it is a service and not a value object – isequalTo() andhashCode(). If your class is not final then you must handleLiskov Substitution Principle to avoid possible memory leaks. That's quite complicated, so it makes sense to forbid deriving a model class to avoid this.

A very good book about this isEffecitve Java from Joshua Bloch.

*/
class DefaultImportScanServiceTest {
finalclass DefaultImportScanServiceTest {
Copy link
Member

Choose a reason for hiding this comment

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

what do you mean in the commit by "This is not a Typical Service"?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Not "typical" means "does not inherit from GenericDefectDojoService". Thisis not very good documented nor well architected. Hope to make implicit stuff like this more explicit during my refacotrings.

@WeltraumschafWeltraumschaf merged commit4c532fa intosecureCodeBox:mainMar 15, 2024
@WeltraumschafWeltraumschaf deleted the tests_for_rest_calls branchMarch 15, 2024 13:14
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@IlyesbdlalaIlyesbdlalaIlyesbdlala approved these changes

Assignees

@WeltraumschafWeltraumschaf

Labels
enhancementNew feature or request
Projects
Archived in project
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Weltraumschaf@Ilyesbdlala

[8]ページ先頭

©2009-2025 Movatter.jp