Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.nio.file Assertions are going to break a lot of Android projects #345

Closed
emilesvt opened this issue Mar 9, 2015 · 12 comments
Closed

Comments

@emilesvt
Copy link

emilesvt commented Mar 9, 2015

We found by way of a few transitive dependencies (assertj-guava:1.2.0) when 2.0.0 was released on Friday a lot of our Android projects stopped working. The File based assertions that were added within the last month aren't going to work on the Dalvik platform as those classes are not available. This will preclude anyone using from assertj in their Android projects from ever moving the 2.x version.

@emilesvt emilesvt changed the title java.io.file Assertions are going to break a lot of Android projects java.nio.file Assertions are going to break a lot of Android projects Mar 9, 2015
@joel-costigliola
Copy link
Member

Well, we can't be stuck to java 6 just because of Android.
Having said that, if there are some assertions you really need, we might just release another 1.x version including them.

@emilesvt
Copy link
Author

We're not missing any assertions and JDK7 support is available for Android, it's just that Dalvik doesn't have all the classes available to it that you'd find in the JRE. I was just throwing this out there so others were aware.

@Sarev0k
Copy link

Sarev0k commented Mar 11, 2015

I'm getting the following compilation error when I try to use AssertJ 2.0 with Android:

    error: cannot access Path
            assertThat(“foo”).isEqualTo(“Bar”);
            ^
    class file for java.nio.file.Path not found
    1 error

Setting the CompileOptions in my build.gradle to enable some Java7 features didn't seem to help:

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

@joel-costigliola
Copy link
Member

The reason was given by @emilesvt previous comment.

@dlubarov
Copy link

AssertJ Core 2.0 relies on Java 7.

I would tweak the release notes to make it clear that it relies on JRE 7 SE classes. It sounded to me like it relies on Java 7 language features, which wouldn't be a problem for most Android projects.

@joel-costigliola
Copy link
Member

Will add that.

@joel-costigliola
Copy link
Member

@dlubarov
Copy link

Thanks!

@1zaman
Copy link

1zaman commented Aug 16, 2016

Done : http://joel-costigliola.github.io/assertj/assertj-core.html

That web page claims that the 2.x version should be suitable for Android.

if there are some assertions you really need, we might just release another 1.x version including them.

The assertion that I was missing is isEqualByComparingTo() in AbstractComparableAssert.

@joel-costigliola
Copy link
Member

joel-costigliola commented Aug 16, 2016

Note that you have to use Java6Assertions and yes it should be mentioned in the documentation but it is not (yet).

@joel-costigliola
Copy link
Member

doc issue created : joel-costigliola/assertj#61

@1zaman
Copy link

1zaman commented Aug 16, 2016

Using Java6Assertions fixes the issue, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants