test: Add AssertJ for plugins, for better assertions (#31380)
PR adds assertj to the plugin modules as well so we can write better assertions there. We're changing just one test, but to illustrate as an example. With the previous assertion used here, failure messages looked like this: ``` Expected <true>, but got <false>. ``` But with the better assertions introduced in this PR, we should see something like: ``` Expected `Random unexpected string` to end with `Host not allowed.` ``` Which should help us much better in troubleshooting.
This commit is contained in:
parent
32d8859762
commit
56b3eba57c
|
|
@ -5,136 +5,79 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|
||||||
<groupId>com.appsmith</groupId>
|
<groupId>com.appsmith</groupId>
|
||||||
|
|
||||||
<artifactId>integrated</artifactId>
|
<artifactId>integrated</artifactId>
|
||||||
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>appsmith-plugins</artifactId>
|
<artifactId>appsmith-plugins</artifactId>
|
||||||
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|
||||||
<module>oraclePlugin</module>
|
<module>oraclePlugin</module>
|
||||||
|
|
||||||
<module>postgresPlugin</module>
|
<module>postgresPlugin</module>
|
||||||
|
|
||||||
<module>restApiPlugin</module>
|
<module>restApiPlugin</module>
|
||||||
|
|
||||||
<module>mongoPlugin</module>
|
<module>mongoPlugin</module>
|
||||||
|
|
||||||
<module>mysqlPlugin</module>
|
<module>mysqlPlugin</module>
|
||||||
|
|
||||||
<module>elasticSearchPlugin</module>
|
<module>elasticSearchPlugin</module>
|
||||||
|
|
||||||
<module>dynamoPlugin</module>
|
<module>dynamoPlugin</module>
|
||||||
|
|
||||||
<module>redisPlugin</module>
|
<module>redisPlugin</module>
|
||||||
|
|
||||||
<module>mssqlPlugin</module>
|
<module>mssqlPlugin</module>
|
||||||
|
|
||||||
<module>firestorePlugin</module>
|
<module>firestorePlugin</module>
|
||||||
|
|
||||||
<module>redshiftPlugin</module>
|
<module>redshiftPlugin</module>
|
||||||
|
|
||||||
<module>amazons3Plugin</module>
|
<module>amazons3Plugin</module>
|
||||||
|
|
||||||
<module>googleSheetsPlugin</module>
|
<module>googleSheetsPlugin</module>
|
||||||
|
|
||||||
<module>graphqlPlugin</module>
|
<module>graphqlPlugin</module>
|
||||||
|
|
||||||
<module>snowflakePlugin</module>
|
<module>snowflakePlugin</module>
|
||||||
|
|
||||||
<module>arangoDBPlugin</module>
|
<module>arangoDBPlugin</module>
|
||||||
|
|
||||||
<module>jsPlugin</module>
|
<module>jsPlugin</module>
|
||||||
|
|
||||||
<module>saasPlugin</module>
|
<module>saasPlugin</module>
|
||||||
|
|
||||||
<module>smtpPlugin</module>
|
<module>smtpPlugin</module>
|
||||||
|
|
||||||
<module>openAiPlugin</module>
|
<module>openAiPlugin</module>
|
||||||
|
|
||||||
<module>anthropicPlugin</module>
|
<module>anthropicPlugin</module>
|
||||||
|
|
||||||
<module>googleAiPlugin</module>
|
<module>googleAiPlugin</module>
|
||||||
<module>appsmithAiPlugin</module>
|
<module>appsmithAiPlugin</module>
|
||||||
|
|
||||||
<module>awsLambdaPlugin</module>
|
<module>awsLambdaPlugin</module>
|
||||||
|
|
||||||
<module>databricksPlugin</module>
|
<module>databricksPlugin</module>
|
||||||
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
||||||
<jjwt.version>0.11.5</jjwt.version>
|
<jjwt.version>0.11.5</jjwt.version>
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>org.pf4j</groupId>
|
<groupId>org.pf4j</groupId>
|
||||||
|
|
||||||
<artifactId>pf4j-spring</artifactId>
|
<artifactId>pf4j-spring</artifactId>
|
||||||
|
|
||||||
<version>0.8.0</version>
|
<version>0.8.0</version>
|
||||||
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
|
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
|
|
||||||
<artifactId>slf4j-reload4j</artifactId>
|
<artifactId>slf4j-reload4j</artifactId>
|
||||||
|
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
|
||||||
</exclusions>
|
</exclusions>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>org.pf4j</groupId>
|
<groupId>org.pf4j</groupId>
|
||||||
|
|
||||||
<artifactId>pf4j</artifactId>
|
<artifactId>pf4j</artifactId>
|
||||||
|
|
||||||
<version>${org.pf4j.version}</version>
|
<version>${org.pf4j.version}</version>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>com.appsmith</groupId>
|
<groupId>com.appsmith</groupId>
|
||||||
|
|
||||||
<artifactId>interfaces</artifactId>
|
<artifactId>interfaces</artifactId>
|
||||||
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Test Dependencies -->
|
<!-- Test Dependencies -->
|
||||||
|
|
@ -142,133 +85,86 @@
|
||||||
<!-- Actual Junit5 implementation. Will transitively include junit-jupiter-api -->
|
<!-- Actual Junit5 implementation. Will transitively include junit-jupiter-api -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>org.junit.platform</groupId>
|
<groupId>org.junit.platform</groupId>
|
||||||
|
|
||||||
<artifactId>junit-platform-suite-engine</artifactId>
|
<artifactId>junit-platform-suite-engine</artifactId>
|
||||||
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- For junit5 parameterised test support -->
|
<!-- For junit5 parameterised test support -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
|
||||||
<artifactId>junit-jupiter-params</artifactId>
|
<artifactId>junit-jupiter-params</artifactId>
|
||||||
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Only required to run junit5 test from IDE -->
|
<!-- Only required to run junit5 test from IDE -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>org.junit.platform</groupId>
|
<groupId>org.junit.platform</groupId>
|
||||||
|
|
||||||
<artifactId>junit-platform-launcher</artifactId>
|
<artifactId>junit-platform-launcher</artifactId>
|
||||||
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>io.projectreactor</groupId>
|
<groupId>io.projectreactor</groupId>
|
||||||
|
|
||||||
<artifactId>reactor-test</artifactId>
|
<artifactId>reactor-test</artifactId>
|
||||||
|
|
||||||
<version>${reactor-test.version}</version>
|
<version>${reactor-test.version}</version>
|
||||||
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
|
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
|
|
||||||
<version>${mockito.version}</version>
|
<version>${mockito.version}</version>
|
||||||
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
|
|
||||||
<artifactId>mockito-inline</artifactId>
|
<artifactId>mockito-inline</artifactId>
|
||||||
|
|
||||||
<version>${mockito.version}</version>
|
<version>${mockito.version}</version>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver3 -->
|
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver3 -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
|
||||||
<artifactId>mockwebserver3</artifactId>
|
<artifactId>mockwebserver3</artifactId>
|
||||||
|
|
||||||
<version>${mockwebserver.version}</version>
|
<version>${mockwebserver.version}</version>
|
||||||
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- We need this dependency only to ensure TestContainers work with JUnit5 -->
|
<!-- We need this dependency only to ensure TestContainers work with JUnit5 -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>io.quarkus</groupId>
|
<groupId>io.quarkus</groupId>
|
||||||
|
|
||||||
<artifactId>quarkus-junit4-mock</artifactId>
|
<artifactId>quarkus-junit4-mock</artifactId>
|
||||||
|
|
||||||
<version>2.14.2.Final</version>
|
<version>2.14.2.Final</version>
|
||||||
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>org.testcontainers</groupId>
|
<groupId>org.testcontainers</groupId>
|
||||||
|
|
||||||
<artifactId>junit-jupiter</artifactId>
|
<artifactId>junit-jupiter</artifactId>
|
||||||
|
|
||||||
<version>${testcontainers.version}</version>
|
<version>${testcontainers.version}</version>
|
||||||
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
|
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
|
||||||
</exclusions>
|
</exclusions>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ import static com.appsmith.external.helpers.restApiUtils.helpers.HintMessageUtil
|
||||||
import static com.appsmith.external.helpers.restApiUtils.helpers.HintMessageUtils.DUPLICATE_ATTRIBUTE_LOCATION.ACTION_CONFIG_ONLY;
|
import static com.appsmith.external.helpers.restApiUtils.helpers.HintMessageUtils.DUPLICATE_ATTRIBUTE_LOCATION.ACTION_CONFIG_ONLY;
|
||||||
import static com.appsmith.external.helpers.restApiUtils.helpers.HintMessageUtils.DUPLICATE_ATTRIBUTE_LOCATION.DATASOURCE_AND_ACTION_CONFIG;
|
import static com.appsmith.external.helpers.restApiUtils.helpers.HintMessageUtils.DUPLICATE_ATTRIBUTE_LOCATION.DATASOURCE_AND_ACTION_CONFIG;
|
||||||
import static com.appsmith.external.helpers.restApiUtils.helpers.HintMessageUtils.DUPLICATE_ATTRIBUTE_LOCATION.DATASOURCE_CONFIG_ONLY;
|
import static com.appsmith.external.helpers.restApiUtils.helpers.HintMessageUtils.DUPLICATE_ATTRIBUTE_LOCATION.DATASOURCE_CONFIG_ONLY;
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertIterableEquals;
|
import static org.junit.jupiter.api.Assertions.assertIterableEquals;
|
||||||
|
|
@ -1912,9 +1913,8 @@ public class RestApiPluginTest {
|
||||||
StepVerifier.create(resultMono)
|
StepVerifier.create(resultMono)
|
||||||
.assertNext(result -> {
|
.assertNext(result -> {
|
||||||
assertFalse(result.getIsExecutionSuccess());
|
assertFalse(result.getIsExecutionSuccess());
|
||||||
assertTrue(result.getPluginErrorDetails()
|
assertThat(result.getPluginErrorDetails().getDownstreamErrorMessage())
|
||||||
.getDownstreamErrorMessage()
|
.endsWith("Host not allowed.");
|
||||||
.contains("Host not allowed."));
|
|
||||||
})
|
})
|
||||||
.verifyComplete();
|
.verifyComplete();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user