-
Notifications
You must be signed in to change notification settings - Fork 11
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
Tests for rest calls #125
Tests for rest calls #125
Conversation
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
9006546
to
d30cab9
Compare
Signed-off-by: Sven Strittmatter <[email protected]>
d30cab9
to
6660d1a
Compare
Signed-off-by: Sven Strittmatter <[email protected]>
Since package is always same, so we can resolve the whole path in the base class. Also put the context information in file name at the end, so that fixtures show up near the test class in the IDE. Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Also fix wrong JSON property mapping. Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
…ethods Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
66515d3
to
4f4e3c9
Compare
Also introduce some defaults to models which came from DefectDojo: We had some fields null by default which will be empty string/array by default in DefectDojo responses. Signed-off-by: Sven Strittmatter <[email protected]>
4f4e3c9
to
eccab28
Compare
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
The structure of code should be ordered, so that the more abstract API is at the top and the more nitty gritty details are below. This has the advantage that one interested in an quick overview need not to 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 <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
Signed-off-by: Sven Strittmatter <[email protected]>
7e2587e
to
e4b6e3f
Compare
There was a problem hiding this 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> { | |||
public final class ProductTypeService extends GenericDefectDojoService<ProductType> { |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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 – is equalTo()
and hashCode()
. If your class is not final then you must handle Liskov 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 is Effecitve Java from Joshua Bloch.
*/ | ||
class DefaultImportScanServiceTest { | ||
final class DefaultImportScanServiceTest { |
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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.
This PR adds capture and replay integration tests for all generic services.