使用InSequence批注时,arquillian UnsupportedOperationException [英] arquillian UnsupportedOperationException when use InSequence annotation

查看:168
本文介绍了使用InSequence批注时,arquillian UnsupportedOperationException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在测试中添加 @InSequence 注释时出现错误:

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)

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?

推荐答案

问题出在JUnit上。我使用版本4.12-beta-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

我降级到版本JUnit 4.11并且所有测试都在没有注释@InSequence的情况下运行。

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

这篇关于使用InSequence批注时,arquillian UnsupportedOperationException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆