Polishing

This commit is contained in:
Arjen Poutsma
2017-04-19 16:49:06 +02:00
parent 30f61e0c07
commit d1e0990293

View File

@@ -1,27 +1,40 @@
/*
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.web.reactive.result.view;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Single;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.MediaType;
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
import org.springframework.mock.http.server.reactive.test.MockServerWebExchange;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.ui.Model;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import org.springframework.http.MediaType;
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
import org.springframework.mock.http.server.reactive.test.MockServerWebExchange;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.web.server.ServerWebExchange;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
/**
* Unit tests for {@link AbstractView}.
@@ -37,12 +50,13 @@ public class AbstractViewTests {
this.exchange = MockServerHttpRequest.get("/").toExchange();
}
@SuppressWarnings("unchecked")
@Test
public void resolveAsyncAttributes() {
TestBean testBean1 = new TestBean("Bean1");
TestBean testBean2 = new TestBean("Bean2");
Map<String, Object> attributes = new HashMap();
Map<String, Object> attributes = new HashMap<>();
attributes.put("attr1", Mono.just(testBean1));
attributes.put("attr2", Flux.just(testBean1, testBean2));
attributes.put("attr3", Single.just(testBean2));