- Where Developers Learn, Share, & Build Careers


I'm having difficulty using the required annotation of June 4 to see exceptions. I can not compile the code because it has an unrestricted exception

This is a simple example that creates a situation:

  import static org.junit.Assert. *; Import java.io.UnsupportedEncodingException; Import org.junit.Test; Public class simple {@ test (expected = unsupported encoding exception. Clash) Public Zero Simple () {string A = ""; A.getBytes ("UTF-123"); }}   

I get a compilation error called "compiled exception type unsupported encoding exception"

It makes sense, and I can make it clear that Simplified unsupported encoding throws an exception, we have seen many examples online where people do not do it (which would be good when writing a lot of test cases).

Is there a way to configure the test case, which clearly tell me what exceptions will be thrown?

As far as I know, unsupported encoding exceptions are a check exception, therefore the compiler expects That throws the section for a checked exception. I think your code will work, if you say that you have tried an arbitrary exception such as arithmetic exception.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -