I have a function that has the following type signature:
def post(target: String, partition: String, payload: String): IO[Boolean]
In this function, a call is placed to a third party to post this data to a service through the awssdk. For testing, I don't want these calls actually placed, which has brought me to scalamock, but am not sure how to do this in looking at the documentation.
Within the post function I have leverage my private instance of aws's client for this service after setting credentials. There is a particular method on this instance that is responsible for the call to aws.
How can scalamock be leveraged to mock the awssdk to test the code I have surrounding this and not make the actual call?
Do you have a trait that defines this method? Then you can use Scalamock to get an instance of it and make it respond to
postcalls with whatever value you want it to.https://scastie.scala-lang.org/KgJ0kptnRaiteNTWPBzrow