Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions java-checks-test-sources/default/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.truth.extensions </groupId>
<groupId>com.google.truth.extensions</groupId>
<artifactId>truth-java8-extension</artifactId>
<version>0.39</version>
<scope>provided</scope>
Expand Down Expand Up @@ -638,6 +638,12 @@
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>spring-mock-mvc</artifactId>
<version>4.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
Expand Down Expand Up @@ -921,25 +927,25 @@
<artifactId>aspectjweaver</artifactId>
<version>1.9.9.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-http</artifactId>
<version>3.7.2</version>
<scope>provided</scope>
</dependency>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-http</artifactId>
<version>3.7.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>6.4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
<scope>provided</scope>
</dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package checks.tests.AssertionsInTestsCheck;

import io.restassured.RestAssured;
import io.restassured.module.mockmvc.RestAssuredMockMvc;
import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.ResponseSpecification;
Expand All @@ -10,6 +11,7 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
import static org.springframework.http.HttpStatus.FORBIDDEN;

class RestAssuredTest {

Expand Down Expand Up @@ -130,4 +132,14 @@ public void test_time() { // Compliant
.then()
.time(lessThan(2L), SECONDS);
}

@Test
public void test_status() {

RestAssuredMockMvc.given()
.when()
.get("/api/expedientes")
.then()
.status(FORBIDDEN);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ public final class UnitTestUtils {
MethodMatchers.create().ofSubTypes("org.fest.assertions.GenericAssert", "org.fest.assertions.api.AbstractAssert").anyName().withAnyParameters().build(),
// rest assured 2.x, 3.x, 4.x
MethodMatchers.create().ofTypes(
"com.jayway.restassured.response.ValidatableResponseOptions", // restassured 2.x
"io.restassured.response.ValidatableResponseOptions" // restassured 3.x and 4.x
)
"com.jayway.restassured.response.ValidatableResponseOptions", // restassured 2.x
"io.restassured.response.ValidatableResponseOptions", // restassured 3.x and 4.x
"io.restassured.module.mockmvc.response.ValidatableMockMvcResponse" // spring mock mvc extending the io.restassured library
)
.name(name -> "body".equals(name) ||
"time".equals(name) ||
name.startsWith("time") ||
Expand Down
Loading