Questions tagged [assertj]

AssertJ provides a set of strongly-typed assertions to use for unit testing (either with JUnit or TestNG).

386 questions
0
votes
2 answers

Testng report assert and continue test

I'm trying to us testng with fluentlenium, and report it to extent reports. The problem is that I have asserts throughout the tests and want to report them without using try and catch. Any ideas how to do it? Is there a assert listener or…
A.H
  • 23
  • 5
0
votes
1 answer

Subtle difference between fest and assert-j with custom map

in the project where I am working it has been decided to stop using fest for test assertions, and instead use assertj. We are using Java 7 and we are moving from fest version 2.0M10 to assertj-core version 2.4.1. The code base is fairly big but the…
Eric Lilja
  • 3,323
  • 4
  • 18
  • 15
0
votes
1 answer

java.lang.NoSuchMethodError: org.assertj.core.api.Assertions.assertThat(Ljava/util/Map;)Lorg/assertj/core/api/MapAssert;

When running unitTest on AndroidStudio (1.4), my below test fail as per title i.e. java.lang.NoSuchMethodError: org.assertj.core.api.Assertions.assertThat(Ljava/util/Map;)Lorg/assertj/core/api/MapAssert; @Test public void mapTest() { Map
Elye
  • 53,639
  • 54
  • 212
  • 474
0
votes
1 answer

AssertJ, Want to do pre and post for each assertThat

I'm Using SoftAssertions in AssertJ and Java 8, For Ex: SoftAssertions softly = new SoftAssertions(); softly.assertThat(mansion.guests()).as("Living…
Praveen Hiremath
  • 4,209
  • 2
  • 17
  • 11
0
votes
1 answer

Complex asserts on collections

I have an actual list of strings generated in my integration test and an expected list of substrings. It is trivial to assert that the collections are equal, e.g.: assertThat(actual).containsExactly(expected); In my case it is a bit more difficult…
Grzenio
  • 35,875
  • 47
  • 158
  • 240
0
votes
1 answer

increase minSdk for androidTest

what is a good way to increase the minSDK for androidTest? Background is this: /tmp/manifestMerge4291657485597766957.xml:0:0 Error: uses-sdk:minSdkVersion 5 cannot be smaller than version 7 declared in library…
ligi
  • 39,001
  • 44
  • 144
  • 244
0
votes
2 answers

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

How to test if class objects are equal using FEST assertThat(...) method? Example: import static org.fest.assertions.api.Assertions.assertThat; @Test public void test() throws Exception { …
etxalpo
  • 1,146
  • 1
  • 14
  • 25
0
votes
2 answers

how to express this special array assertion in code?

I am currently using FEST or AssertJ for assertion. and I run into a knot that I want to assert the flowing array: [1,2,2,2,2,2,2] So how do I write the assertion like assertThat(arr).contains(1,atIndex(0)).containsTheOthers(2) I don't see…
WeiChing 林煒清
  • 4,452
  • 3
  • 30
  • 65
-1
votes
2 answers

How to test if an exception was thrown?

My code: public String getTemplate(TestType fileType) { Util util = new Util(); try { return util.addPrefix(util.getTemplate(fileType)); } catch (IOException e) { logger.warn(e.getMessage()); throw new…
Amikuto
  • 1
  • 1
-1
votes
2 answers

The import org.assertj.core.api.Assertions.catchException cannot be resolved in VSCode

When I am trying to launch my Spring application using VSCode's Extension Pack for Java which has import static org.assertj.core.api.Assertions.catchException; in one of the tests, I get build failed with the following message: The import…
Wiktor
  • 71
  • 1
  • 9
-2
votes
2 answers

Problems when importing AssertJ and JUnit

I'm at university and I have to submit a project. I'm having problems with Assertj and JUnit when importing. I'll leave below some images of my problem. I'll really appreciate if someone could help me! Thank you!
Joaco Terniro
  • 115
  • 1
  • 2
  • 13
1 2 3
25
26