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



def orderId = orderDetail.orderId


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



assertThat(orderResponse.getStatusCode(), 201)

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

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

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 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

Your code will never run.

How about this?

assert orderResponse.getStatusCode() == 201