Skip to content

import static org.assertj.core.api.Assertions.* clashes with URI (java.net.URI) #1567

@mp911de

Description

@mp911de

Summary

Statically importing AssertJ assertions imports fields from InstanceOfAssertFactories. The URI field shadows java.net.URI and requires fully qualified naming when using java.net.URI.

There's a similar issue for URL as these two types match exactly constant names from InstanceOfAssertFactories.

Example

import static org.assertj.core.api.Assertions.*;

URI.create("http://foo")

Compilation failure:


PagedResourcesAssemblerUnitTests.java:[272,79] cannot find symbol
   symbol:   method create(java.lang.String)
   location: variable URI of type org.assertj.core.api.InstanceOfAssertFactory<java.net.URI,org.assertj.core.api.AbstractUriAssert<?>>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions