Alex Po
Alex Po

Reputation: 2035

arquillian UnsupportedOperationException when use InSequence annotation

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?

Upvotes: 2

Views: 704

Answers (2)

Marcelo Daniel
Marcelo Daniel

Reputation: 143

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.

Upvotes: 0

Alex Po
Alex Po

Reputation: 2035

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.

Upvotes: 4

Related Questions