Menu
  • HOME
  • TAGS

Can you add a custom message to AssertJ assertThat?

java,unit-testing,junit,assertj

And in classic fashion, I found what I was looking for moments after posting the question. Hopefully this will make it easier for the next person to find without first having to know what it's called. The magic method is the deceptively short-named as, which is part of another interface...

Android AssertJ 1.0.0 with Android gradle 1.1.1

android,gradle,android-gradle,assertj,android-assertj

I ran into the same issue. This fixed it for me: testCompile('com.squareup.assertj:assertj-android:1.0.0'){ exclude group: 'com.android.support', module:'support-annotations' } ...

How to perform deeper matching of keys and values with assertj

java,assertj

There is not easy solution for this. One way is to implement a custom Assertion for the character map. Here is a simple custom Assertion example for this problem: public class CharacterMapAssert extends AbstractMapAssert<MapAssert<Character, Integer>, Map<Character, Integer>, Character, Integer> { public CharacterMapAssert(Map<Character, Integer> actual) { super(actual, CharacterMapAssert.class); } public static...

How to test equality between class objects using FEST assertThat(…) method?

java,junit4,fest,assertj

First of all you should use AssertJ; FEST is outdated by this package. But since AssertJ shares a similar syntax, the transition will be easy. Second, well, with AssertJ, this works out of the box... This compiles for me: // irrelevant code, then assertThat(findClass()).isEqualTo(Integer.class); } private Class<?> findClass() { return...