arquillian UnsupportedOperationException when use InSequence annotation

妖精的绣舞 提交于 2019-12-22 12:32:38

问题


I get the error when I add @InSequence annotation to my tests:

java.lang.UnsupportedOperationException at java.util.Collections$UnmodifiableList$1.set(Collections.java:1412) at java.util.Collections.sort(Collections.java:234) at org.jboss.arquillian.junit.Arquillian.getChildren(Arquillian.java:71) at org.junit.runners.ParentRunner.getFilteredChildren(ParentRunner.java:426) at org.junit.runners.ParentRunner.getDescription(ParentRunner.java:351) at org.junit.runners.Suite.describeChild(Suite.java:123) at com.intellij.junit4.IdeaSuite.describeChild(IdeaSuite.java:68) at com.intellij.junit4.IdeaSuite.getChildren(IdeaSuite.java:85) at org.junit.runners.ParentRunner.getFilteredChildren(ParentRunner.java:426) at org.junit.runners.ParentRunner.filter(ParentRunner.java:379) at org.junit.runner.manipulation.Filter.apply(Filter.java:97) at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:37)

When I run tests without this annotation all goes ok. Any idea what's wrong?


回答1:


The problem was in JUnit. I used version 4.12-beta-1 which returns unmodifiable list in this method:

public List<FrameworkMethod> getAnnotatedMethods(
        Class<? extends Annotation> annotationClass) {
    return Collections.unmodifiableList(getAnnotatedMembers(methodsForAnnotations, annotationClass, false));
}

Class org.junit.runners.model.TestClass.

I downgraded to version JUnit 4.11 and all test was runned without problems with annotation @InSequence.




回答2:


The same with me. Even with the 4.12 final version of Junit. As workaround in my case I extend the Arquillian class and override the method getChildren. Then, the main difference is convert the unmodifiable colletion to a modified.



来源:https://stackoverflow.com/questions/25219233/arquillian-unsupportedoperationexception-when-use-insequence-annotation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!