3

I'm trying to write an MXUnit test for a component I'm mocking up that throws an error. When it throws an error of a certain type I get a struct back from the service I'm calling. Is there a way to mock up a struct and return that with the mock?

The relevant code is

bankValidator.getBankName("test",12345).throws("myException");

I want a way for that code to .returns(e) when e = { error = 'Invalid Routing Number'}. Chaining .returns() on the end of my code does not return anything.

Maybe there's a better way to go about achieving this result?

Matt Busche
  • 14,216
  • 5
  • 36
  • 61

0 Answers0