723
questions
0
votes
2
answers
30
views
containsInAnyOrder hamcrest matcher with custom comparator
I have a DTO class
class MyDto {
private String f1;
private String f2;
private String f3;
// constructor
// get set equals/hashCode
}
It has equal/hascode pair which takes into ...
1
vote
0
answers
32
views
assert that all elements of a list are called on 4 different functions using assertAll
I would like to write a test in which I pass in as an argument a list of values, and I assert that 4 different methods are called using each value. For example
@ParameterizedTest
@SomeKindOfSource
...
0
votes
0
answers
36
views
Why does upgrading firebase-admin from 9.3 to 9.4 cause Junit to fail with an error about a shaded Hamcrest class?
I created a minimally reproducible testcase here, which can be run like this:
git clone https://github.com/fatso83/issue-reproductions
cd issue-reproductions/noclassdeffound_shaded_package
mvn test
...
0
votes
0
answers
50
views
How to use PyHamcrest with nested dictionaries and lists
I'm trying to use PyHamcrest python library to validate if a nested dictionary (sub graph) is a subset of a another larger nested dictionary (full graph).
In the example below, I'm trying to validate ...
0
votes
1
answer
44
views
Type mismatch for custom generic type in Kotlin
In Kotlin I can write:
fun foo(): List<String> {
return ArrayList<String>().apply { this.add("1234") }
}
and it works without any issues.
But I tried to do the same with my ...
1
vote
0
answers
73
views
Rest-Assured and Hamcrest matchers not working with comparing arrays of ints
With Rest Assured i'm parcing rest-response and comparing arrays.
Response body:
{
"error": {
"errorObjects": [
{
"risks": [
{
...
0
votes
0
answers
31
views
Maven dependency management project in eclipse
While creating a maven project in eclipse,under maven dependencies I got junit3.8.1.jar file but hamcrest-core 1.3.jar file is missing,and it's dependencies are also missing.when my sir was teaching ...
-1
votes
1
answer
85
views
Hamcrest(Java) errors
I'm using REST Assured with Hamcrest matchers in my tests:
given()
//...
.assertThat()
.body("id", arrayContaining(job1.getId(), job2.getId()))
.statusCode(200);
After ...
0
votes
0
answers
167
views
How to assert list of object with RestAssured body and matcher hasItem
My endpoint returns List as JSON and I want to assert that the response contains correct transactions.
given().when()
.get(path)
.then()
.statusCode(200)
.header("...
0
votes
0
answers
17
views
How to assert that my return data from MockMvc correctly sorts my data
I am writing test for a Spring Controller, and I want to assert that the returned data is sorted according to supplied parameters (sort column, ascending/descending). So far I've been extracting a ...
0
votes
1
answer
79
views
Why is Hamcrest arrayWithSize not working with Kotlin
I'm trying to test the length of an integer array with hamcrest and <
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.collection.IsArrayWithSize.arrayWithSize
import org.hamcrest....
0
votes
0
answers
37
views
(io.confluent.connect.avro.AvroDataConfig:370) Exception in thread "main" java.lang.NoClassDefFoundError: org/hamcrest/Matcher
I am running ksql-tests via command line and I get this error. I tried adding jar manually to classpath before running tests, but still shows this error.
How can I run ksql-test-runner via command ...
2
votes
2
answers
94
views
Can't use Espresso test parameter injector with org hamcrest Matchers?
Within an existing project with espresso tests, I want to parameterized espresso tests so I add in the project configuration the declaration
implementation 'com.google.testparameterinjector:test-...
1
vote
0
answers
268
views
Duplicate class (org.hamcrest:hamcrest-core:1.1) and junit-4.10 (junit:junit:4.10)
I'm currently in the process of compiling my project within Android Studio, and I'm consistently encountering the same error. Despite my best efforts, which have involved making numerous adjustments ...
-1
votes
1
answer
103
views
How does `containsInAnyOrder` compare items?
I've got a CustomField class and I've overriden the equals and hashcode methods. But when I try to compare 2 lists of CustomField objects, it fails.
Why wouldn't the containsInAnyOrder work in the ...