415 questions
-1
votes
1
answer
65
views
Asserting on generic response body
How do you assert on a JSON list of objects with MockMvcTester?
I want to cleanly map it to List<MyDto> and assert on that list.
import com.example.em_card_service.data.dto.response....
-2
votes
2
answers
214
views
Asserting Mono completion softly
Suppose I need to softly assert against multiple object properties, one of which is a Mono. Typically, you use StepVerifier to assert against that. However, the verifyComplete() call will not be soft. ...
0
votes
0
answers
78
views
How to use xpath with MockMvcTester?
I have the following test with MockMvc:
mockMvc.perform(get("/")
.andExpect(xpath("//div[...]").string("..."));
How can I use xpath with the new MockMvcTester ...
1
vote
1
answer
126
views
Showing differences between non-matching strings using assertJ
I'm currently working on a unit test for a kotlin function that will generate a csv file from some model data. I'm running into some strange test failures and the default output from assertJ isn't ...
0
votes
1
answer
74
views
Assertj-DB says h2 table does not exist
I have set up a simple spring-boot app with schema.sql file and a JpaRepository for the Person entity class.
I can verify that the schema is initialized and that the repository can write and read to ...
1
vote
0
answers
94
views
Is it possible to forcing assertj to use a consistent internal representation?
I have a proto message that includes a field for Tags:
message Tags {
map<string, bool> tagset = 1;
}
message Msg {
Tags tags = 1;
}
I'm reading in a text proto file for unit testing. The ...
0
votes
0
answers
376
views
Importing org.assertj.core.api.Assertions throws an error in Eclipse
I'm currently trying to import the Assertj library into my Eclipse project to use the assertThat() assertion but I get an error when trying to import Assertj java library.
import static org.assertj....
1
vote
1
answer
555
views
How to extract multiple JSON paths with MockMvcTester?
I'm trying to convert my MockMvc test to use the new MockMvcTester.
Here is my current test code:
mockMvc.perform(get("/api/persons"))
.andExpect(status().isOk())
.andExpect(...
0
votes
1
answer
124
views
Assertj not able to read a null field using 'extracting'
I am trying to extract a null field and assert it is null. However, assertJ reads the field as Boolean false instead of null.
the field i am trying to extract is marked below. As you can see it is ...
0
votes
1
answer
77
views
AssertJ JUnitSoftAssertions how to wait for page to load
I am using JUnitSoftAssertions and I like it so far. But sometimes, the click on call-to-action button takes longer than the next assertion, so it causes test failed.
For example:
@Rule
public final ...
0
votes
1
answer
126
views
Why Use json.parse() Instead of json.parseObject() in First Assertion in Spring Boot JSON Test?
I'm working through a code example from the official Spring Academy course, specifically a test that deserializes JSON into a CashCard object using JacksonTester.
Here's the relevant code snippet:
...
1
vote
3
answers
170
views
AssertJ How To Compare Parent Object to a Child Object that casted to The Parent Instance
I have problem on assertJ comparison for the Child object that casted to Parent object.
I just wanted to compare all the properties of the Parent object to the expected value object.
Example
class Dog ...
1
vote
1
answer
200
views
Is there an AssertJ predicate to return the original object under test?
I'm testing that a class returns an instance of the same type modified in some way. After initializing the object I want to make verify that starting state. So for example:
CLS cls = new CLS(a, b, c);
...
0
votes
1
answer
83
views
Kotlin spread operator for an array of functions does not satisfy Java Function<>... function argument definition
I need an overlay function around AssertJ extracting assertion.
Its current implementation:
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.groups.Tuple
fun <T, R> ...
1
vote
1
answer
78
views
AssertJ's assertThatCode behaves differently than JUnit's assertThrows
I am having this test, junit assestion works well, while the same assertj assertion does not.
@Test
void registerWithDuplicatedEmail() throws EmailAlreadyRegistered {
Mockito.when(customerCommand....