Questions tagged [assertthat]

27 questions
1
vote
1 answer

How to use AssertThat to check the property value of objects in a list?

I am to using asserThat to verify properties of objects in an ArrayList. I am able to use assertThat if none of the objects contains data to be tested but I am not able to figure how to use assertThat if only one of the objects contain data…
1
vote
2 answers

How to make JUnit assertThat() work with lower bounded wildcard?

initially, I had this piece of production code: interface ActionSequence { public List getActions(); I tested classes implementing that interface with something like this: assertThat(sequenceUnderTest.getActions(),…
GhostCat
  • 137,827
  • 25
  • 176
  • 248
0
votes
1 answer

assertthat in R with pairlist

I am trying to use assertthat::assert_that() on several conditions to be tested, which are collected in a `pairlist'. The pairlist that I have a looks like this: pairlist_1 <- as.pairlist(alist(is.null(list()),…
dkarlez
  • 1
  • 1
0
votes
1 answer

Maven Selenium Project - 'Cannot resolve symbol 'AssertionsForClassTypes' in IntelliJ

I am getting the following 2 errors in my Maven project:- 'Cannot resolve symbol 'AssertionsForClassTypes' 'Cannot resolve method 'assertThat' in 'SearchTest' In the pom.xml file, the following dependency exists:
JeannieW
  • 1
  • 2
0
votes
1 answer

Hamcrest assertThat() error - objects are not the same

I have trouble with comparing two object. var response = api.getRequest(); response.statusCode(200); response.body(JsonSchemaValidator.matchesJsonSchema....); var bodyResponse = response.extract().as(ExampleResponse.class); var bodyExpected =…
Marcin
  • 97
  • 7
0
votes
1 answer

R: error when printing character() in assert_that message

I would like to assert some expressions involving certain variable that is potentially evaluated to character(). I would like to print an assertation message showing the value of the variable which can be character(). assertthat::assert_that(
englealuze
  • 1,445
  • 12
  • 19
0
votes
1 answer

How to use assertThat with any condition?

How can I write the following assertion: org.junit.Assert.assertTrue(result.any { it.name == "Foo" }) with Google Truth assertThat? com.google.common.truth.Truth.assertThat(result...
JJD
  • 50,076
  • 60
  • 203
  • 339
0
votes
0 answers

Contains returning false for two identical objects

I have a MetroStop class as below: public class MetroStop { public int identifiant; public double longitude; public double latitude; public String nom; public String destination; public String moyen; public MetroStop() { } public…
Will Wost
  • 105
  • 2
  • 9
0
votes
1 answer

How to use hamcrest nullValue with type inference in assertThat

I need to write test case using junit 5 and assertThat to check for null value. I have written as below. However, this is giving error with respect to mismatch datatype. @Test void shouldReturnNull() { …
user2800089
  • 2,015
  • 6
  • 26
  • 47
0
votes
0 answers

Java: Selenium WebElements and AssertThat giving incorrect result

Ok. Either this is actually weird, or there's something fundamental that I'm missing. I have a bit of code that tries to assert the non-existence of a list of WebElements. If I use assert and < 1 for the list size, it works. But my preferred…
user9347168
0
votes
1 answer

Hamcrest AssetThat equalTo fails because of a unicode character "'\u200E' 8206" in the object value array

I'm using Hamcrest for asserting in my tests. The below snippet works for other string comparisons, however below statement is failing because of some random character(?) at 0th place in the object value array as shown in attached image…
tyro
  • 577
  • 8
  • 17
0
votes
3 answers

containsString is undefined

I have a Junit(5) test case that's looking for an exception when a variable is out of bounds, and I raise an IllegalArgumentException for it. @Test void testOutOfBoundsException() { Foo f = new Foo(); IllegalArgumentException e =…
michjnich
  • 2,796
  • 3
  • 15
  • 31
1
2