Skip to content
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

beFailedTry.withThrowable can't use the super type #291

Closed
andyczerwonka opened this issue Aug 23, 2014 · 2 comments
Closed

beFailedTry.withThrowable can't use the super type #291

andyczerwonka opened this issue Aug 23, 2014 · 2 comments

Comments

@andyczerwonka
Copy link

Firstly, I realize this is most likely not a bug. I'm looking for an alternative solution.

The Mongo java driver (via Casbah) throws the following exception:

@Deprecated
public static class DuplicateKey extends DuplicateKeyException

Because DuplicateKey is deprecated, I would like to write my tests using their suggested DuplicateKeyException. I am trying to write a test that goes something like this:

"fail to add a duplicate user" in {
  cleanDb {
    create("joe", "blow", "jb@email.com")
    create("same", "email", "jb@email.com") must beFailedTry.withThrowable[DuplicateKeyException]
  }
}

but the driver is still throwing the specific DuplicateKey. Should I just use the deprecated method for now? Is there a better way to wite the test given the deprecation?

@etorreborre
Copy link
Owner

Hi Andy sorry for seeing your message only now. It is available now in 2.4.2.

etorreborre added a commit that referenced this issue Aug 31, 2014
@andyczerwonka
Copy link
Author

No worries, thanks for making the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants