Skip to content

Commit 8628aaa

Browse files
committed
228: Added dependencies and test
1 parent 0b92255 commit 8628aaa

File tree

2 files changed

+37
-24
lines changed

2 files changed

+37
-24
lines changed

java/sqlcommenter-java/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ dependencies {
6161
compile (group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.5.RELEASE') {
6262
exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j'
6363
}
64+
65+
compile (group: 'org.springframework.boot', name: 'spring-boot-starter-webflux', version: '2.7.7') {
66+
exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j'
67+
}
68+
69+
compile (group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version: '2.7.7') {
70+
exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j'
71+
}
72+
73+
testImplementation 'io.projectreactor:reactor-test:3.5.2'
74+
75+
compile 'io.r2dbc:r2dbc-proxy:1.1.0.RELEASE'
76+
compile 'io.r2dbc:r2dbc-spi:1.0.0.RELEASE'
77+
6478
compile 'org.apache.logging.log4j:log4j-to-slf4j:2.16.0'
6579

6680
compile 'org.hibernate:hibernate-core:5.4.3.Final'

java/sqlcommenter-java/src/test/java/com/google/cloud/sqlcommenter/filter/SpringSQLCommenterWebFilterTest.java

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,32 @@
88
import org.springframework.web.reactive.result.method.RequestMappingInfo;
99
import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerMapping;
1010
import org.springframework.web.server.WebFilterChain;
11-
1211
import reactor.core.publisher.Mono;
1312
import reactor.test.StepVerifier;
1413

15-
1614
@RunWith(JUnit4.class)
1715
public class SpringSQLCommenterWebFilterTest {
1816

19-
@Test
20-
public void testPreHandlePlacesStateInContextView() throws NoSuchMethodException {
21-
RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping();
22-
RequestMappingInfo info = RequestMappingInfo.paths("/test").build();
23-
requestMappingHandlerMapping.registerMapping(info, this, SpringSQLCommenterWebFilterTest.class.getMethod("testPreHandlePlacesStateInContextView"));
24-
25-
SpringSQLCommenterWebFilter springSQLCommenterWebFilter = new SpringSQLCommenterWebFilter(requestMappingHandlerMapping);
26-
27-
WebFilterChain filterChain = filterExchange -> Mono.empty();
28-
29-
MockServerWebExchange exchange = MockServerWebExchange.from(
30-
MockServerHttpRequest
31-
.get("/test"));
32-
33-
StepVerifier.create(springSQLCommenterWebFilter.filter(exchange, filterChain))
34-
.expectAccessibleContext()
35-
.hasKey("state")
36-
.then()
37-
.verifyComplete();
38-
}
39-
40-
}
17+
@Test
18+
public void testPreHandlePlacesStateInContextView() throws NoSuchMethodException {
19+
RequestMappingHandlerMapping requestMappingHandlerMapping = new RequestMappingHandlerMapping();
20+
RequestMappingInfo info = RequestMappingInfo.paths("/test").build();
21+
requestMappingHandlerMapping.registerMapping(
22+
info,
23+
this,
24+
SpringSQLCommenterWebFilterTest.class.getMethod("testPreHandlePlacesStateInContextView"));
25+
26+
SpringSQLCommenterWebFilter springSQLCommenterWebFilter =
27+
new SpringSQLCommenterWebFilter(requestMappingHandlerMapping);
28+
29+
WebFilterChain filterChain = filterExchange -> Mono.empty();
30+
31+
MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/test"));
32+
33+
StepVerifier.create(springSQLCommenterWebFilter.filter(exchange, filterChain))
34+
.expectAccessibleContext()
35+
.hasKey("state")
36+
.then()
37+
.verifyComplete();
38+
}
39+
}

0 commit comments

Comments
 (0)