Skip to content

Commit

Permalink
Change mock types to glassfish
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisLainez committed Apr 24, 2024
1 parent 6436555 commit 81b9fbf
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package com.netflix.conductor.client.http

import jakarta.ws.rs.client.Entity
import org.glassfish.jersey.client.ClientResponse

import com.netflix.conductor.common.metadata.events.EventHandler
Expand All @@ -34,23 +35,29 @@ class EventClientSpec extends ClientSpecification {
given:
EventHandler handler = new EventHandler()
URI uri = createURI("event")
Invocation.Builder invocationBuilder = Mock(Invocation.Builder.class)

when:
eventClient.registerEventHandler(handler)

then:
1 * requestHandler.getWebResourceBuilder(uri, handler) >> Mock(Invocation.Builder.class)
1 * requestHandler.getWebResourceBuilder(uri) >> invocationBuilder
1 * invocationBuilder.post(Entity.json(handler), null)

}

def "update event handler"() {
given:
EventHandler handler = new EventHandler()
URI uri = createURI("event")
Invocation.Builder invocationBuilder = Mock(Invocation.Builder.class)

when:
eventClient.updateEventHandler(handler)

then:
1 * requestHandler.getWebResourceBuilder(uri, handler) >> Mock(Invocation.Builder.class)
1 * requestHandler.getWebResourceBuilder(uri) >> invocationBuilder
1 * invocationBuilder.put(Entity.json(handler))
}

def "unregister event handler"() {
Expand Down Expand Up @@ -78,7 +85,7 @@ class EventClientSpec extends ClientSpecification {
then:
eventHandlers && eventHandlers.size() == 2
1 * requestHandler.get(uri) >> Mock(ClientResponse.class) {
getEntity(_) >> handlers
readEntity(_) >> handlers
}

where:
Expand Down

0 comments on commit 81b9fbf

Please sign in to comment.