How to custom format REST Assured method chaining in Intellij IDEA

164 Views Asked by At

Trying to custom format my REST Assured method chaining using the latest version of IntelliJ IDEA.


Am using IntelliJ IDEA Ultimate 2020.3 Build #IU-203.5981.144, built on November 30, 2020 and REST Assured 4.3.2.


pom.xml:

<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>rest-assured</artifactId>
    <version>4.3.2</version>
</dependency>

<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>json-path</artifactId>
    <version>4.3.2</version>
</dependency>

When I write code in IntelliJ IDEA, it automatically formats the method chaining as follows:

enter image description here

What I seek to do is somehow have IntelliJ IDEA let me format the code inside the getOrders() method to display like this:

given().
 when().
     get(BASE_URL+"/v1/orders").
 then().
     statusCode(200); 

When trying to start lines with the period first, it still doesn't format correctly, so when trying this:

given()
 .when()
     .get(BASE_URL+"/v1/orders")
 .then()
     .statusCode(200); 

IntelliJ IDEA automatically reformats it to:

 given().when()
        .get(BASE_URL+"/v1/orders")
        .then()
        .statusCode(200); 

I want the .then() method to indented (e.g. 4 spaces to the right) and not on the same column as get(BASE_URL+"/v1/orders") and statusCode(200);


Currently, IntelliJ reformats the method chaining in a default setting and its impossible to move the method calls around (even using the . periods and tab key).

Is the a setting / preference to change this?

0

There are 0 best solutions below