Import springframwork into STS and build it

Build: #857 failed

Job: Default Job failed

Stages & jobs

  1. Default Stage

Build it with eclipse: Test case result

The below summarizes the result of the test "Build it with eclipse" in build 857 of Spring IDE - Build Test - spring-framework - Default Job. View test case history
Description
Build it with eclipse
Test class
org.springframework.ide.eclipse.buildtest.springframework.SpringFrameworkBuildTest
Method
buildItWithEclipse
Duration
3 mins
Status
Failed (Existing Failure)

Error Log

java.lang.AssertionError: Expecting no problems but found: Marker {
   rsrc = /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java
   severity = 2
   sourceId = JDT
   charStart = 7440
   charEnd = 7972
   arguments = 2:reactor.core.publisher.Mono<java.lang.Object>#reactor.core.publisher.Mono<org.springframework.web.reactive.function.server.ServerResponse>
   id = 16777235
   message = Type mismatch: cannot convert from Mono<Object> to Mono<ServerResponse>
   lineNumber = 192
   categoryId = 40
}>>>>>>>>> /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java
  1: /*  2:  * Copyright 2002-2017 the original author or authors.  3:  *  4:  * Licensed under the Apache License, Version 2.0 (the "License");  5:  * you may not use this file except in compliance with the License.  6:  * You may obtain a copy of the License at  7:  *  8:  *      http://www.apache.org/licenses/LICENSE-2.0  9:  * 10:  * Unless required by applicable law or agreed to in writing, software 11:  * distributed under the License is distributed on an "AS IS" BASIS, 12:  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13:  * See the License for the specific language governing permissions and 14:  * limitations under the License. 15:  */ 16:  17: package org.springframework.web.reactive.function.server; 18:  19: import java.util.Optional; 20: import java.util.concurrent.atomic.AtomicBoolean; 21:  22: import org.junit.Test; 23: import reactor.core.publisher.Mono; 24: import reactor.test.StepVerifier; 25:  26: import org.springframework.http.HttpHeaders; 27: import org.springframework.http.HttpStatus; 28: import org.springframework.http.ResponseCookie; 29: import org.springframework.http.server.reactive.HttpHandler; 30: import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; 31: import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; 32: import org.springframework.util.LinkedMultiValueMap; 33: import org.springframework.util.MultiValueMap; 34: import org.springframework.web.server.ResponseStatusException; 35: import org.springframework.web.server.ServerWebExchange; 36: import org.springframework.web.server.WebFilter; 37: import org.springframework.web.server.WebFilterChain; 38:  39: import static org.junit.Assert.*; 40: import static org.mockito.Mockito.*; 41:  42: /** 43:  * @author Arjen Poutsma 44:  * @since 5.0 45:  */ 46: @SuppressWarnings("unchecked") 47: public class RouterFunctionsTests { 48:  49:  @Test 50:  public void routeMatch() { 51:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 52:  53:   MockServerRequest request = MockServerRequest.builder().build(); 54:   RequestPredicate requestPredicate = mock(RequestPredicate.class); 55:   when(requestPredicate.test(request)).thenReturn(true); 56:  57:   RouterFunction<ServerResponse> 58:     result = RouterFunctions.route(requestPredicate, handlerFunction); 59:   assertNotNull(result); 60:  61:   Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 62:  63:   StepVerifier.create(resultHandlerFunction) 64:     .expectNext(handlerFunction) 65:     .expectComplete() 66:     .verify(); 67:  } 68:  69:  @Test 70:  public void routeNoMatch() { 71:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 72:  73:   MockServerRequest request = MockServerRequest.builder().build(); 74:   RequestPredicate requestPredicate = mock(RequestPredicate.class); 75:   when(requestPredicate.test(request)).thenReturn(false); 76:  77:   RouterFunction<ServerResponse> result = RouterFunctions.route(requestPredicate, handlerFunction); 78:   assertNotNull(result); 79:  80:   Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 81:   StepVerifier.create(resultHandlerFunction) 82:     .expectComplete() 83:     .verify(); 84:  } 85:  86:  @Test 87:  public void nestMatch() { 88:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 89:   RouterFunction<ServerResponse> routerFunction = request -> Mono.just(handlerFunction); 90:  91:   MockServerRequest request = MockServerRequest.builder().build(); 92:   RequestPredicate requestPredicate = mock(RequestPredicate.class); 93:   when(requestPredicate.nest(request)).thenReturn(Optional.of(request)); 94:  95:   RouterFunction<ServerResponse> result = RouterFunctions.nest(requestPredicate, routerFunction); 96:   assertNotNull(result); 97:  98:   Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 99:   StepVerifier.create(resultHandlerFunction)100:     .expectNext(handlerFunction)101:     .expectComplete()102:     .verify();103:  }104: 105:  @Test106:  public void nestNoMatch() {107:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build();108:   RouterFunction<ServerResponse> routerFunction = request -> Mono.just(handlerFunction);109: 110:   MockServerRequest request = MockServerRequest.builder().build();111:   RequestPredicate requestPredicate = mock(RequestPredicate.class);112:   when(requestPredicate.nest(request)).thenReturn(Optional.empty());113: 114:   RouterFunction<ServerResponse> result = RouterFunctions.nest(requestPredicate, routerFunction);115:   assertNotNull(result);116: 117:   Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request);118:   StepVerifier.create(resultHandlerFunction)119:     .expectComplete()120:     .verify();121:  }122: 123:  @Test124:  public void toHttpHandlerNormal() {125:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.accepted().build();126:   RouterFunction<ServerResponse> routerFunction =127:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);128: 129:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);130:   assertNotNull(result);131: 132:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();133:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();134:   result.handle(httpRequest, httpResponse).block();135:   assertEquals(HttpStatus.ACCEPTED, httpResponse.getStatusCode());136:  }137: 138:  @Test139:  public void toHttpHandlerHandlerThrowsException() {140:   HandlerFunction<ServerResponse> handlerFunction =141:     request -> {142:      throw new IllegalStateException();143:     };144:   RouterFunction<ServerResponse> routerFunction =145:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);146: 147:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);148:   assertNotNull(result);149: 150:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();151:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();152:   result.handle(httpRequest, httpResponse).block();153:   assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, httpResponse.getStatusCode());154:  }155: 156:  @Test157:  public void toHttpHandlerHandlerReturnsException() {158:   HandlerFunction<ServerResponse> handlerFunction =159:     request -> Mono.error(new IllegalStateException());160:   RouterFunction<ServerResponse> routerFunction =161:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);162: 163:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);164:   assertNotNull(result);165: 166:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();167:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();168:   result.handle(httpRequest, httpResponse).block();169:   assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, httpResponse.getStatusCode());170:  }171: 172:  @Test173:  public void toHttpHandlerHandlerResponseStatusException() {174:   HandlerFunction<ServerResponse> handlerFunction =175:     request -> Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found"));176:   RouterFunction<ServerResponse> routerFunction =177:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);178: 179:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);180:   assertNotNull(result);181: 182:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();183:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();184:   result.handle(httpRequest, httpResponse).block();185:   assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());186:  }187: 188:  @Test189:  public void toHttpHandlerHandlerReturnResponseStatusExceptionInResponseWriteTo() {190:   HandlerFunction<ServerResponse> handlerFunction =191:     // Mono.<ServerResponse> is required for compilation in Eclipse192:     request -> Mono.just(new ServerResponse() {193:      @Override194:      public HttpStatus statusCode() {195:       return HttpStatus.OK;196:      }197:      @Override198:      public HttpHeaders headers() {199:       return new HttpHeaders();200:      }201:      @Override202:      public MultiValueMap<String, ResponseCookie> cookies() {203:       return new LinkedMultiValueMap<>();204:      }205:      @Override206:      public Mono<Void> writeTo(ServerWebExchange exchange, Context context) {207:       return Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found"));208:      }209:     });210:   RouterFunction<ServerResponse> routerFunction =211:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);212: 213:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);214:   assertNotNull(result);215: 216:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();217:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();218:   result.handle(httpRequest, httpResponse).block();219:   assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());220:  }221: 222:  @Test223:  public void toHttpHandlerHandlerThrowResponseStatusExceptionInResponseWriteTo() {224:   HandlerFunction<ServerResponse> handlerFunction =225:     // Mono.<ServerResponse> is required for compilation in Eclipse226:     request -> Mono.just(new ServerResponse() {227:      @Override228:      public HttpStatus statusCode() {229:       return HttpStatus.OK;230:      }231:      @Override232:      public HttpHeaders headers() {233:       return new HttpHeaders();234:      }235:      @Override236:      public MultiValueMap<String, ResponseCookie> cookies() {237:       return new LinkedMultiValueMap<>();238:      }239:      @Override240:      public Mono<Void> writeTo(ServerWebExchange exchange, Context context) {241:       throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found");242:      }243:     });244:   RouterFunction<ServerResponse> routerFunction =245:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);246: 247:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);248:   assertNotNull(result);249: 250:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();251:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();252:   result.handle(httpRequest, httpResponse).block();253:   assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());254:  }255: 256:  @Test257:  public void toHttpHandlerWebFilter() {258:   AtomicBoolean filterInvoked = new AtomicBoolean();259: 260:   WebFilter webFilter = new WebFilter() {261:    @Override262:    public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {263:     filterInvoked.set(true);264:     return chain.filter(exchange);265:    }266:   };267: 268:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.accepted().build();269:   RouterFunction<ServerResponse> routerFunction =270:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);271: 272:   HandlerStrategies handlerStrategies = HandlerStrategies.builder()273:     .webFilter(webFilter).build();274: 275:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction, handlerStrategies);276:   assertNotNull(result);277: 278:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();279:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();280:   result.handle(httpRequest, httpResponse).block();281:   assertEquals(HttpStatus.ACCEPTED, httpResponse.getStatusCode());282: 283:   assertTrue(filterInvoked.get());284:  }285: 286: }<<<<<<<<< /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java

Marker {
   rsrc = /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java
   severity = 2
   sourceId = JDT
   charStart = 8702
   charEnd = 9221
   arguments = 2:reactor.core.publisher.Mono<java.lang.Object>#reactor.core.publisher.Mono<org.springframework.web.reactive.function.server.ServerResponse>
   id = 16777235
   message = Type mismatch: cannot convert from Mono<Object> to Mono<ServerResponse>
   lineNumber = 226
   categoryId = 40
}>>>>>>>>> /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java
  1: /*  2:  * Copyright 2002-2017 the original author or authors.  3:  *  4:  * Licensed under the Apache License, Version 2.0 (the "License");  5:  * you may not use this file except in compliance with the License.  6:  * You may obtain a copy of the License at  7:  *  8:  *      http://www.apache.org/licenses/LICENSE-2.0  9:  * 10:  * Unless required by applicable law or agreed to in writing, software 11:  * distributed under the License is distributed on an "AS IS" BASIS, 12:  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13:  * See the License for the specific language governing permissions and 14:  * limitations under the License. 15:  */ 16:  17: package org.springframework.web.reactive.function.server; 18:  19: import java.util.Optional; 20: import java.util.concurrent.atomic.AtomicBoolean; 21:  22: import org.junit.Test; 23: import reactor.core.publisher.Mono; 24: import reactor.test.StepVerifier; 25:  26: import org.springframework.http.HttpHeaders; 27: import org.springframework.http.HttpStatus; 28: import org.springframework.http.ResponseCookie; 29: import org.springframework.http.server.reactive.HttpHandler; 30: import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; 31: import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; 32: import org.springframework.util.LinkedMultiValueMap; 33: import org.springframework.util.MultiValueMap; 34: import org.springframework.web.server.ResponseStatusException; 35: import org.springframework.web.server.ServerWebExchange; 36: import org.springframework.web.server.WebFilter; 37: import org.springframework.web.server.WebFilterChain; 38:  39: import static org.junit.Assert.*; 40: import static org.mockito.Mockito.*; 41:  42: /** 43:  * @author Arjen Poutsma 44:  * @since 5.0 45:  */ 46: @SuppressWarnings("unchecked") 47: public class RouterFunctionsTests { 48:  49:  @Test 50:  public void routeMatch() { 51:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 52:  53:   MockServerRequest request = MockServerRequest.builder().build(); 54:   RequestPredicate requestPredicate = mock(RequestPredicate.class); 55:   when(requestPredicate.test(request)).thenReturn(true); 56:  57:   RouterFunction<ServerResponse> 58:     result = RouterFunctions.route(requestPredicate, handlerFunction); 59:   assertNotNull(result); 60:  61:   Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 62:  63:   StepVerifier.create(resultHandlerFunction) 64:     .expectNext(handlerFunction) 65:     .expectComplete() 66:     .verify(); 67:  } 68:  69:  @Test 70:  public void routeNoMatch() { 71:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 72:  73:   MockServerRequest request = MockServerRequest.builder().build(); 74:   RequestPredicate requestPredicate = mock(RequestPredicate.class); 75:   when(requestPredicate.test(request)).thenReturn(false); 76:  77:   RouterFunction<ServerResponse> result = RouterFunctions.route(requestPredicate, handlerFunction); 78:   assertNotNull(result); 79:  80:   Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 81:   StepVerifier.create(resultHandlerFunction) 82:     .expectComplete() 83:     .verify(); 84:  } 85:  86:  @Test 87:  public void nestMatch() { 88:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 89:   RouterFunction<ServerResponse> routerFunction = request -> Mono.just(handlerFunction); 90:  91:   MockServerRequest request = MockServerRequest.builder().build(); 92:   RequestPredicate requestPredicate = mock(RequestPredicate.class); 93:   when(requestPredicate.nest(request)).thenReturn(Optional.of(request)); 94:  95:   RouterFunction<ServerResponse> result = RouterFunctions.nest(requestPredicate, routerFunction); 96:   assertNotNull(result); 97:  98:   Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 99:   StepVerifier.create(resultHandlerFunction)100:     .expectNext(handlerFunction)101:     .expectComplete()102:     .verify();103:  }104: 105:  @Test106:  public void nestNoMatch() {107:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build();108:   RouterFunction<ServerResponse> routerFunction = request -> Mono.just(handlerFunction);109: 110:   MockServerRequest request = MockServerRequest.builder().build();111:   RequestPredicate requestPredicate = mock(RequestPredicate.class);112:   when(requestPredicate.nest(request)).thenReturn(Optional.empty());113: 114:   RouterFunction<ServerResponse> result = RouterFunctions.nest(requestPredicate, routerFunction);115:   assertNotNull(result);116: 117:   Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request);118:   StepVerifier.create(resultHandlerFunction)119:     .expectComplete()120:     .verify();121:  }122: 123:  @Test124:  public void toHttpHandlerNormal() {125:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.accepted().build();126:   RouterFunction<ServerResponse> routerFunction =127:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);128: 129:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);130:   assertNotNull(result);131: 132:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();133:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();134:   result.handle(httpRequest, httpResponse).block();135:   assertEquals(HttpStatus.ACCEPTED, httpResponse.getStatusCode());136:  }137: 138:  @Test139:  public void toHttpHandlerHandlerThrowsException() {140:   HandlerFunction<ServerResponse> handlerFunction =141:     request -> {142:      throw new IllegalStateException();143:     };144:   RouterFunction<ServerResponse> routerFunction =145:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);146: 147:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);148:   assertNotNull(result);149: 150:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();151:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();152:   result.handle(httpRequest, httpResponse).block();153:   assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, httpResponse.getStatusCode());154:  }155: 156:  @Test157:  public void toHttpHandlerHandlerReturnsException() {158:   HandlerFunction<ServerResponse> handlerFunction =159:     request -> Mono.error(new IllegalStateException());160:   RouterFunction<ServerResponse> routerFunction =161:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);162: 163:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);164:   assertNotNull(result);165: 166:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();167:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();168:   result.handle(httpRequest, httpResponse).block();169:   assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, httpResponse.getStatusCode());170:  }171: 172:  @Test173:  public void toHttpHandlerHandlerResponseStatusException() {174:   HandlerFunction<ServerResponse> handlerFunction =175:     request -> Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found"));176:   RouterFunction<ServerResponse> routerFunction =177:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);178: 179:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);180:   assertNotNull(result);181: 182:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();183:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();184:   result.handle(httpRequest, httpResponse).block();185:   assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());186:  }187: 188:  @Test189:  public void toHttpHandlerHandlerReturnResponseStatusExceptionInResponseWriteTo() {190:   HandlerFunction<ServerResponse> handlerFunction =191:     // Mono.<ServerResponse> is required for compilation in Eclipse192:     request -> Mono.just(new ServerResponse() {193:      @Override194:      public HttpStatus statusCode() {195:       return HttpStatus.OK;196:      }197:      @Override198:      public HttpHeaders headers() {199:       return new HttpHeaders();200:      }201:      @Override202:      public MultiValueMap<String, ResponseCookie> cookies() {203:       return new LinkedMultiValueMap<>();204:      }205:      @Override206:      public Mono<Void> writeTo(ServerWebExchange exchange, Context context) {207:       return Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found"));208:      }209:     });210:   RouterFunction<ServerResponse> routerFunction =211:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);212: 213:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);214:   assertNotNull(result);215: 216:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();217:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();218:   result.handle(httpRequest, httpResponse).block();219:   assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());220:  }221: 222:  @Test223:  public void toHttpHandlerHandlerThrowResponseStatusExceptionInResponseWriteTo() {224:   HandlerFunction<ServerResponse> handlerFunction =225:     // Mono.<ServerResponse> is required for compilation in Eclipse226:     request -> Mono.just(new ServerResponse() {227:      @Override228:      public HttpStatus statusCode() {229:       return HttpStatus.OK;230:      }231:      @Override232:      public HttpHeaders headers() {233:       return new HttpHeaders();234:      }235:      @Override236:      public MultiValueMap<String, ResponseCookie> cookies() {237:       return new LinkedMultiValueMap<>();238:      }239:      @Override240:      public Mono<Void> writeTo(ServerWebExchange exchange, Context context) {241:       throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found");242:      }243:     });244:   RouterFunction<ServerResponse> routerFunction =245:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);246: 247:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);248:   assertNotNull(result);249: 250:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();251:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();252:   result.handle(httpRequest, httpResponse).block();253:   assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());254:  }255: 256:  @Test257:  public void toHttpHandlerWebFilter() {258:   AtomicBoolean filterInvoked = new AtomicBoolean();259: 260:   WebFilter webFilter = new WebFilter() {261:    @Override262:    public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {263:     filterInvoked.set(true);264:     return chain.filter(exchange);265:    }266:   };267: 268:   HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.accepted().build();269:   RouterFunction<ServerResponse> routerFunction =270:     RouterFunctions.route(RequestPredicates.all(), handlerFunction);271: 272:   HandlerStrategies handlerStrategies = HandlerStrategies.builder()273:     .webFilter(webFilter).build();274: 275:   HttpHandler result = RouterFunctions.toHttpHandler(routerFunction, handlerStrategies);276:   assertNotNull(result);277: 278:   MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();279:   MockServerHttpResponse httpResponse = new MockServerHttpResponse();280:   result.handle(httpRequest, httpResponse).block();281:   assertEquals(HttpStatus.ACCEPTED, httpResponse.getStatusCode());282: 283:   assertTrue(filterInvoked.get());284:  }285: 286: }<<<<<<<<< /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java


java.lang.AssertionError: Expecting no problems but found: Marker {
   rsrc = /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java
   severity = 2
   sourceId = JDT
   charStart = 7440
   charEnd = 7972
   arguments = 2:reactor.core.publisher.Mono<java.lang.Object>#reactor.core.publisher.Mono<org.springframework.web.reactive.function.server.ServerResponse>
   id = 16777235
   message = Type mismatch: cannot convert from Mono<Object> to Mono<ServerResponse>
   lineNumber = 192
   categoryId = 40
}>>>>>>>>> /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java
  1: /*  2:  * Copyright 2002-2017 the original author or authors.  3:  *  4:  * Licensed under the Apache License, Version 2.0 (the "License");  5:  * you may not use this file except in compliance with the License.  6:  * You may obtain a copy of the License at  7:  *  8:  *      http://www.apache.org/licenses/LICENSE-2.0  9:  * 10:  * Unless required by applicable law or agreed to in writing, software 11:  * distributed under the License is distributed on an "AS IS" BASIS, 12:  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13:  * See the License for the specific language governing permissions and 14:  * limitations under the License. 15:  */ 16:  17: package org.springframework.web.reactive.function.server; 18:  19: import java.util.Optional; 20: import java.util.concurrent.atomic.AtomicBoolean; 21:  22: import org.junit.Test; 23: import reactor.core.publisher.Mono; 24: import reactor.test.StepVerifier; 25:  26: import org.springframework.http.HttpHeaders; 27: import org.springframework.http.HttpStatus; 28: import org.springframework.http.ResponseCookie; 29: import org.springframework.http.server.reactive.HttpHandler; 30: import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; 31: import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; 32: import org.springframework.util.LinkedMultiValueMap; 33: import org.springframework.util.MultiValueMap; 34: import org.springframework.web.server.ResponseStatusException; 35: import org.springframework.web.server.ServerWebExchange; 36: import org.springframework.web.server.WebFilter; 37: import org.springframework.web.server.WebFilterChain; 38:  39: import static org.junit.Assert.*; 40: import static org.mockito.Mockito.*; 41:  42: /** 43:  * @author Arjen Poutsma 44:  * @since 5.0 45:  */ 46: @SuppressWarnings("unchecked") 47: public class RouterFunctionsTests { 48:  49: 	@Test 50: 	public void routeMatch() { 51: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 52:  53: 		MockServerRequest request = MockServerRequest.builder().build(); 54: 		RequestPredicate requestPredicate = mock(RequestPredicate.class); 55: 		when(requestPredicate.test(request)).thenReturn(true); 56:  57: 		RouterFunction<ServerResponse> 58: 				result = RouterFunctions.route(requestPredicate, handlerFunction); 59: 		assertNotNull(result); 60:  61: 		Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 62:  63: 		StepVerifier.create(resultHandlerFunction) 64: 				.expectNext(handlerFunction) 65: 				.expectComplete() 66: 				.verify(); 67: 	} 68:  69: 	@Test 70: 	public void routeNoMatch() { 71: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 72:  73: 		MockServerRequest request = MockServerRequest.builder().build(); 74: 		RequestPredicate requestPredicate = mock(RequestPredicate.class); 75: 		when(requestPredicate.test(request)).thenReturn(false); 76:  77: 		RouterFunction<ServerResponse> result = RouterFunctions.route(requestPredicate, handlerFunction); 78: 		assertNotNull(result); 79:  80: 		Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 81: 		StepVerifier.create(resultHandlerFunction) 82: 				.expectComplete() 83: 				.verify(); 84: 	} 85:  86: 	@Test 87: 	public void nestMatch() { 88: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 89: 		RouterFunction<ServerResponse> routerFunction = request -> Mono.just(handlerFunction); 90:  91: 		MockServerRequest request = MockServerRequest.builder().build(); 92: 		RequestPredicate requestPredicate = mock(RequestPredicate.class); 93: 		when(requestPredicate.nest(request)).thenReturn(Optional.of(request)); 94:  95: 		RouterFunction<ServerResponse> result = RouterFunctions.nest(requestPredicate, routerFunction); 96: 		assertNotNull(result); 97:  98: 		Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 99: 		StepVerifier.create(resultHandlerFunction)100: 				.expectNext(handlerFunction)101: 				.expectComplete()102: 				.verify();103: 	}104: 105: 	@Test106: 	public void nestNoMatch() {107: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build();108: 		RouterFunction<ServerResponse> routerFunction = request -> Mono.just(handlerFunction);109: 110: 		MockServerRequest request = MockServerRequest.builder().build();111: 		RequestPredicate requestPredicate = mock(RequestPredicate.class);112: 		when(requestPredicate.nest(request)).thenReturn(Optional.empty());113: 114: 		RouterFunction<ServerResponse> result = RouterFunctions.nest(requestPredicate, routerFunction);115: 		assertNotNull(result);116: 117: 		Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request);118: 		StepVerifier.create(resultHandlerFunction)119: 				.expectComplete()120: 				.verify();121: 	}122: 123: 	@Test124: 	public void toHttpHandlerNormal() {125: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.accepted().build();126: 		RouterFunction<ServerResponse> routerFunction =127: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);128: 129: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);130: 		assertNotNull(result);131: 132: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();133: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();134: 		result.handle(httpRequest, httpResponse).block();135: 		assertEquals(HttpStatus.ACCEPTED, httpResponse.getStatusCode());136: 	}137: 138: 	@Test139: 	public void toHttpHandlerHandlerThrowsException() {140: 		HandlerFunction<ServerResponse> handlerFunction =141: 				request -> {142: 					throw new IllegalStateException();143: 				};144: 		RouterFunction<ServerResponse> routerFunction =145: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);146: 147: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);148: 		assertNotNull(result);149: 150: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();151: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();152: 		result.handle(httpRequest, httpResponse).block();153: 		assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, httpResponse.getStatusCode());154: 	}155: 156: 	@Test157: 	public void toHttpHandlerHandlerReturnsException() {158: 		HandlerFunction<ServerResponse> handlerFunction =159: 				request -> Mono.error(new IllegalStateException());160: 		RouterFunction<ServerResponse> routerFunction =161: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);162: 163: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);164: 		assertNotNull(result);165: 166: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();167: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();168: 		result.handle(httpRequest, httpResponse).block();169: 		assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, httpResponse.getStatusCode());170: 	}171: 172: 	@Test173: 	public void toHttpHandlerHandlerResponseStatusException() {174: 		HandlerFunction<ServerResponse> handlerFunction =175: 				request -> Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found"));176: 		RouterFunction<ServerResponse> routerFunction =177: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);178: 179: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);180: 		assertNotNull(result);181: 182: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();183: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();184: 		result.handle(httpRequest, httpResponse).block();185: 		assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());186: 	}187: 188: 	@Test189: 	public void toHttpHandlerHandlerReturnResponseStatusExceptionInResponseWriteTo() {190: 		HandlerFunction<ServerResponse> handlerFunction =191: 				// Mono.<ServerResponse> is required for compilation in Eclipse192: 				request -> Mono.just(new ServerResponse() {193: 					@Override194: 					public HttpStatus statusCode() {195: 						return HttpStatus.OK;196: 					}197: 					@Override198: 					public HttpHeaders headers() {199: 						return new HttpHeaders();200: 					}201: 					@Override202: 					public MultiValueMap<String, ResponseCookie> cookies() {203: 						return new LinkedMultiValueMap<>();204: 					}205: 					@Override206: 					public Mono<Void> writeTo(ServerWebExchange exchange, Context context) {207: 						return Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found"));208: 					}209: 				});210: 		RouterFunction<ServerResponse> routerFunction =211: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);212: 213: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);214: 		assertNotNull(result);215: 216: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();217: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();218: 		result.handle(httpRequest, httpResponse).block();219: 		assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());220: 	}221: 222: 	@Test223: 	public void toHttpHandlerHandlerThrowResponseStatusExceptionInResponseWriteTo() {224: 		HandlerFunction<ServerResponse> handlerFunction =225: 				// Mono.<ServerResponse> is required for compilation in Eclipse226: 				request -> Mono.just(new ServerResponse() {227: 					@Override228: 					public HttpStatus statusCode() {229: 						return HttpStatus.OK;230: 					}231: 					@Override232: 					public HttpHeaders headers() {233: 						return new HttpHeaders();234: 					}235: 					@Override236: 					public MultiValueMap<String, ResponseCookie> cookies() {237: 						return new LinkedMultiValueMap<>();238: 					}239: 					@Override240: 					public Mono<Void> writeTo(ServerWebExchange exchange, Context context) {241: 						throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found");242: 					}243: 				});244: 		RouterFunction<ServerResponse> routerFunction =245: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);246: 247: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);248: 		assertNotNull(result);249: 250: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();251: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();252: 		result.handle(httpRequest, httpResponse).block();253: 		assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());254: 	}255: 256: 	@Test257: 	public void toHttpHandlerWebFilter() {258: 		AtomicBoolean filterInvoked = new AtomicBoolean();259: 260: 		WebFilter webFilter = new WebFilter() {261: 			@Override262: 			public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {263: 				filterInvoked.set(true);264: 				return chain.filter(exchange);265: 			}266: 		};267: 268: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.accepted().build();269: 		RouterFunction<ServerResponse> routerFunction =270: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);271: 272: 		HandlerStrategies handlerStrategies = HandlerStrategies.builder()273: 				.webFilter(webFilter).build();274: 275: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction, handlerStrategies);276: 		assertNotNull(result);277: 278: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();279: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();280: 		result.handle(httpRequest, httpResponse).block();281: 		assertEquals(HttpStatus.ACCEPTED, httpResponse.getStatusCode());282: 283: 		assertTrue(filterInvoked.get());284: 	}285: 286: }<<<<<<<<< /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java

Marker {
   rsrc = /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java
   severity = 2
   sourceId = JDT
   charStart = 8702
   charEnd = 9221
   arguments = 2:reactor.core.publisher.Mono<java.lang.Object>#reactor.core.publisher.Mono<org.springframework.web.reactive.function.server.ServerResponse>
   id = 16777235
   message = Type mismatch: cannot convert from Mono<Object> to Mono<ServerResponse>
   lineNumber = 226
   categoryId = 40
}>>>>>>>>> /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java
  1: /*  2:  * Copyright 2002-2017 the original author or authors.  3:  *  4:  * Licensed under the Apache License, Version 2.0 (the "License");  5:  * you may not use this file except in compliance with the License.  6:  * You may obtain a copy of the License at  7:  *  8:  *      http://www.apache.org/licenses/LICENSE-2.0  9:  * 10:  * Unless required by applicable law or agreed to in writing, software 11:  * distributed under the License is distributed on an "AS IS" BASIS, 12:  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13:  * See the License for the specific language governing permissions and 14:  * limitations under the License. 15:  */ 16:  17: package org.springframework.web.reactive.function.server; 18:  19: import java.util.Optional; 20: import java.util.concurrent.atomic.AtomicBoolean; 21:  22: import org.junit.Test; 23: import reactor.core.publisher.Mono; 24: import reactor.test.StepVerifier; 25:  26: import org.springframework.http.HttpHeaders; 27: import org.springframework.http.HttpStatus; 28: import org.springframework.http.ResponseCookie; 29: import org.springframework.http.server.reactive.HttpHandler; 30: import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest; 31: import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse; 32: import org.springframework.util.LinkedMultiValueMap; 33: import org.springframework.util.MultiValueMap; 34: import org.springframework.web.server.ResponseStatusException; 35: import org.springframework.web.server.ServerWebExchange; 36: import org.springframework.web.server.WebFilter; 37: import org.springframework.web.server.WebFilterChain; 38:  39: import static org.junit.Assert.*; 40: import static org.mockito.Mockito.*; 41:  42: /** 43:  * @author Arjen Poutsma 44:  * @since 5.0 45:  */ 46: @SuppressWarnings("unchecked") 47: public class RouterFunctionsTests { 48:  49: 	@Test 50: 	public void routeMatch() { 51: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 52:  53: 		MockServerRequest request = MockServerRequest.builder().build(); 54: 		RequestPredicate requestPredicate = mock(RequestPredicate.class); 55: 		when(requestPredicate.test(request)).thenReturn(true); 56:  57: 		RouterFunction<ServerResponse> 58: 				result = RouterFunctions.route(requestPredicate, handlerFunction); 59: 		assertNotNull(result); 60:  61: 		Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 62:  63: 		StepVerifier.create(resultHandlerFunction) 64: 				.expectNext(handlerFunction) 65: 				.expectComplete() 66: 				.verify(); 67: 	} 68:  69: 	@Test 70: 	public void routeNoMatch() { 71: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 72:  73: 		MockServerRequest request = MockServerRequest.builder().build(); 74: 		RequestPredicate requestPredicate = mock(RequestPredicate.class); 75: 		when(requestPredicate.test(request)).thenReturn(false); 76:  77: 		RouterFunction<ServerResponse> result = RouterFunctions.route(requestPredicate, handlerFunction); 78: 		assertNotNull(result); 79:  80: 		Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 81: 		StepVerifier.create(resultHandlerFunction) 82: 				.expectComplete() 83: 				.verify(); 84: 	} 85:  86: 	@Test 87: 	public void nestMatch() { 88: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build(); 89: 		RouterFunction<ServerResponse> routerFunction = request -> Mono.just(handlerFunction); 90:  91: 		MockServerRequest request = MockServerRequest.builder().build(); 92: 		RequestPredicate requestPredicate = mock(RequestPredicate.class); 93: 		when(requestPredicate.nest(request)).thenReturn(Optional.of(request)); 94:  95: 		RouterFunction<ServerResponse> result = RouterFunctions.nest(requestPredicate, routerFunction); 96: 		assertNotNull(result); 97:  98: 		Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request); 99: 		StepVerifier.create(resultHandlerFunction)100: 				.expectNext(handlerFunction)101: 				.expectComplete()102: 				.verify();103: 	}104: 105: 	@Test106: 	public void nestNoMatch() {107: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.ok().build();108: 		RouterFunction<ServerResponse> routerFunction = request -> Mono.just(handlerFunction);109: 110: 		MockServerRequest request = MockServerRequest.builder().build();111: 		RequestPredicate requestPredicate = mock(RequestPredicate.class);112: 		when(requestPredicate.nest(request)).thenReturn(Optional.empty());113: 114: 		RouterFunction<ServerResponse> result = RouterFunctions.nest(requestPredicate, routerFunction);115: 		assertNotNull(result);116: 117: 		Mono<HandlerFunction<ServerResponse>> resultHandlerFunction = result.route(request);118: 		StepVerifier.create(resultHandlerFunction)119: 				.expectComplete()120: 				.verify();121: 	}122: 123: 	@Test124: 	public void toHttpHandlerNormal() {125: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.accepted().build();126: 		RouterFunction<ServerResponse> routerFunction =127: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);128: 129: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);130: 		assertNotNull(result);131: 132: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();133: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();134: 		result.handle(httpRequest, httpResponse).block();135: 		assertEquals(HttpStatus.ACCEPTED, httpResponse.getStatusCode());136: 	}137: 138: 	@Test139: 	public void toHttpHandlerHandlerThrowsException() {140: 		HandlerFunction<ServerResponse> handlerFunction =141: 				request -> {142: 					throw new IllegalStateException();143: 				};144: 		RouterFunction<ServerResponse> routerFunction =145: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);146: 147: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);148: 		assertNotNull(result);149: 150: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();151: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();152: 		result.handle(httpRequest, httpResponse).block();153: 		assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, httpResponse.getStatusCode());154: 	}155: 156: 	@Test157: 	public void toHttpHandlerHandlerReturnsException() {158: 		HandlerFunction<ServerResponse> handlerFunction =159: 				request -> Mono.error(new IllegalStateException());160: 		RouterFunction<ServerResponse> routerFunction =161: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);162: 163: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);164: 		assertNotNull(result);165: 166: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();167: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();168: 		result.handle(httpRequest, httpResponse).block();169: 		assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, httpResponse.getStatusCode());170: 	}171: 172: 	@Test173: 	public void toHttpHandlerHandlerResponseStatusException() {174: 		HandlerFunction<ServerResponse> handlerFunction =175: 				request -> Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found"));176: 		RouterFunction<ServerResponse> routerFunction =177: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);178: 179: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);180: 		assertNotNull(result);181: 182: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();183: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();184: 		result.handle(httpRequest, httpResponse).block();185: 		assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());186: 	}187: 188: 	@Test189: 	public void toHttpHandlerHandlerReturnResponseStatusExceptionInResponseWriteTo() {190: 		HandlerFunction<ServerResponse> handlerFunction =191: 				// Mono.<ServerResponse> is required for compilation in Eclipse192: 				request -> Mono.just(new ServerResponse() {193: 					@Override194: 					public HttpStatus statusCode() {195: 						return HttpStatus.OK;196: 					}197: 					@Override198: 					public HttpHeaders headers() {199: 						return new HttpHeaders();200: 					}201: 					@Override202: 					public MultiValueMap<String, ResponseCookie> cookies() {203: 						return new LinkedMultiValueMap<>();204: 					}205: 					@Override206: 					public Mono<Void> writeTo(ServerWebExchange exchange, Context context) {207: 						return Mono.error(new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found"));208: 					}209: 				});210: 		RouterFunction<ServerResponse> routerFunction =211: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);212: 213: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);214: 		assertNotNull(result);215: 216: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();217: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();218: 		result.handle(httpRequest, httpResponse).block();219: 		assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());220: 	}221: 222: 	@Test223: 	public void toHttpHandlerHandlerThrowResponseStatusExceptionInResponseWriteTo() {224: 		HandlerFunction<ServerResponse> handlerFunction =225: 				// Mono.<ServerResponse> is required for compilation in Eclipse226: 				request -> Mono.just(new ServerResponse() {227: 					@Override228: 					public HttpStatus statusCode() {229: 						return HttpStatus.OK;230: 					}231: 					@Override232: 					public HttpHeaders headers() {233: 						return new HttpHeaders();234: 					}235: 					@Override236: 					public MultiValueMap<String, ResponseCookie> cookies() {237: 						return new LinkedMultiValueMap<>();238: 					}239: 					@Override240: 					public Mono<Void> writeTo(ServerWebExchange exchange, Context context) {241: 						throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found");242: 					}243: 				});244: 		RouterFunction<ServerResponse> routerFunction =245: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);246: 247: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction);248: 		assertNotNull(result);249: 250: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();251: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();252: 		result.handle(httpRequest, httpResponse).block();253: 		assertEquals(HttpStatus.NOT_FOUND, httpResponse.getStatusCode());254: 	}255: 256: 	@Test257: 	public void toHttpHandlerWebFilter() {258: 		AtomicBoolean filterInvoked = new AtomicBoolean();259: 260: 		WebFilter webFilter = new WebFilter() {261: 			@Override262: 			public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {263: 				filterInvoked.set(true);264: 				return chain.filter(exchange);265: 			}266: 		};267: 268: 		HandlerFunction<ServerResponse> handlerFunction = request -> ServerResponse.accepted().build();269: 		RouterFunction<ServerResponse> routerFunction =270: 				RouterFunctions.route(RequestPredicates.all(), handlerFunction);271: 272: 		HandlerStrategies handlerStrategies = HandlerStrategies.builder()273: 				.webFilter(webFilter).build();274: 275: 		HttpHandler result = RouterFunctions.toHttpHandler(routerFunction, handlerStrategies);276: 		assertNotNull(result);277: 278: 		MockServerHttpRequest httpRequest = MockServerHttpRequest.get("http://localhost").build();279: 		MockServerHttpResponse httpResponse = new MockServerHttpResponse();280: 		result.handle(httpRequest, httpResponse).block();281: 		assertEquals(HttpStatus.ACCEPTED, httpResponse.getStatusCode());282: 283: 		assertTrue(filterInvoked.get());284: 	}285: 286: }<<<<<<<<< /spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java


	at org.junit.Assert.fail(Assert.java:88)
	at org.springframework.ide.eclipse.buildtest.springframework.SpringFrameworkBuildTest.assertNoErrors(SpringFrameworkBuildTest.java:94)
	at org.springframework.ide.eclipse.buildtest.springframework.SpringFrameworkBuildTest.buildItWithEclipse(SpringFrameworkBuildTest.java:75)