Spock structure: how can I automatically declare the state of an object to reset after BOM completes

I have a Spring service A

that uses a service internally B

.

I want to:

  • Mock service B

  • Install the sent version to the service A

  • Testing A

    behavior
  • Install a previous version of the service B

    for maintenance A

    (reset state)

The problem is with the last step - I can remember B

in setup

and set it in stages cleanup

. But can I set it up automatically (something similar to @ConfineMetaClassChanges

)

+3


source to share


1 answer


This is not supported out of the box, but can be implemented as a JUnit rule or a Spock extension. ( @ConfineMetaClassChanges

is a Spock extension.)



0


source







All Articles