assertThat() is applicable for argument types: (java.lang.Integer) values: [201]

i am using below code to check the response code. i got the response code as 201 but assert statement still failed … please anyone help me

‘’’’’’’’’’’’’
assertThat(orderResponse.getStatusCode()).isEqualTo(201)

WS.delay(2)

def orderId = orderDetail.orderId

‘’’’’’’’’’’’’’’’’’’’

How about moving your parenthesis from where it is, to the end? Like:

assertThat(orderResponse.getStatusCode().isEqualTo(201))

or

assertThat(orderResponse.getStatusCode(), 201)

same issue : “assertThat(orderResponse.getStatusCode().isEqualTo(201))”

13: Assertions.assertThat(getStatusCode().isEqualTo(201))

Reason:
groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.isEqualTo() is applicable for argument types: (java.lang.Integer) values: [201]

???

What is assertThat? Groovy language does not have it built-in. It must be some custom class. Then how did you write import xxxx.xxxxx.xxx statement for it? Did you forget it? Then no way it will run.

What is isEqualTo() method? groovy.lang.Integer class does not implement isEqualTo() at all. See https://docs.groovy-lang.org/latest/html/groovy-jdk/java/lang/Integer.html

Your code will never run.

How about this?

assert orderResponse.getStatusCode() == 201