Junit5: Namespace potential collisions

Created on 11 Feb 2017  路  2Comments  路  Source: junit-team/junit5

ExtensionContext.Namespace is implemented via a Set/HashSet. This allows for two namespaces to easily collide:

@Test void test() {
    assertNotEquals(Namespace.create("a", "b"), Namespace.create("b", "a"));
}

Intuitively namespaces should nest, meaning the above two are expected to be different. This can be easily fixed by using a List in the impl.

I'm using https://oss.sonatype.org/content/repositories/snapshots/org/junit/jupiter/junit-jupiter-api/5.0.0-SNAPSHOT/junit-jupiter-api-5.0.0-20170207.113945-373.jar

programming model

Most helpful comment

Team decision: Change implementation to use List instead of Set.

All 2 comments

Hmm, I must admit that I'm a bit surprised by this, too. However, the Javadoc states "The order of the parts is not significant.".

@junit-team/junit-lambda Do you remember why this was implemented this way?

Team decision: Change implementation to use List instead of Set.

Was this page helpful?
0 / 5 - 0 ratings