-
Notifications
You must be signed in to change notification settings - Fork 569
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
Increase user task client test coverage #19420
Conversation
Recreating #19382 because I merged that too quickly. |
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 one is already approved, but we don't want to merge it before #19333.
306c7ce
to
a01e217
Compare
3f4e904
to
b229723
Compare
9cbadfb
to
127ba24
Compare
b229723
to
c9e9c34
Compare
127ba24
to
c7d99ff
Compare
bd3b256
to
14f3dc3
Compare
663be93
to
19ce6a4
Compare
14f3dc3
to
a90dede
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.
clients/java/src/test/java/io/camunda/zeebe/client/util/RestGatewayService.java
Outdated
Show resolved
Hide resolved
clients/java/src/test/java/io/camunda/zeebe/client/util/RestGatewayService.java
Show resolved
Hide resolved
clients/java/src/test/java/io/camunda/zeebe/client/util/RestGatewayService.java
Outdated
Show resolved
Hide resolved
clients/java/src/test/java/io/camunda/zeebe/client/usertask/AssignUserTaskTest.java
Show resolved
Hide resolved
clients/java/src/test/java/io/camunda/zeebe/client/usertask/AssignUserTaskTest.java
Show resolved
Hide resolved
void shouldRaiseExceptionOnError() { | ||
// given | ||
gatewayService.errorOnRequest( | ||
String.format(RestGatewayService.URL_USER_TASK_ASSIGNMENT, 123L), |
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.
🔧 If you happen to move the template strings into a separate class, you could provide a method to get the URL. It can be implemented with this same call to String.format
, but provide more clarity to the reader. For example, this could allow method chaining to clarify intent (although perhaps a bit overengineered):
gatewayService.errorOnRequest(
GatewayServicePaths.resolveUrl(resource: USER_TASK).key(123L).assignment()
() -> new ProblemDetail().title("Not Found").status(404));
💭 This also makes me think that it may be useful to allow passing a specific request method to the errorOnRequest
, so tests have more control over the specific request that's mocked.
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.
Interesting thought, I'll give this a try 👍
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.
I played around with that for a bit but I think we're really over-engineering this for what we currently need. I settled for a "middle ground", making the URL templates internal and providing respective static getters that clarify what arguments are required to build a proper URL for each endpoint.
Let me know what you think.
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.
I like it! 👍
clients/java/src/test/java/io/camunda/zeebe/client/usertask/CompleteUserTaskTest.java
Show resolved
Hide resolved
Adds unit tests to the Java client to ensure the user task-related commands for assigning, completing, unassigning, and updating tasks work as expected.
Moves the REST URLs into a dedicated class that takes care of building them correctly. The URL templates are internal and there is a getter for each of them, clarifying which arguments are needed to build a proper URL.
In the Java client, the user task assignment command doesn't allow providing a null assignee. The respective test class is extended to ensure this behavior.
a90dede
to
b44381f
Compare
For the sake of progress, I'll go ahead and merge here. Any further suggestions can go into follow-up issues. |
Description
Adds unit tests to the Java client to ensure the user task-related commands for assigning, completing, unassigning, and updating tasks work as expected.
Related issues
closes #19374