use of org.springframework.core.ResolvableType in project spring-framework by spring-projects.
the class MessageReaderArgumentResolverTests method rxJava2SingleTestBean.
@Test
public void rxJava2SingleTestBean() throws Exception {
String body = "{\"bar\":\"b1\",\"foo\":\"f1\"}";
ResolvableType type = forClassWithGenerics(io.reactivex.Single.class, TestBean.class);
MethodParameter param = this.testMethod.arg(type);
io.reactivex.Single<TestBean> single = resolveValue(param, body);
assertEquals(new TestBean("f1", "b1"), single.blockingGet());
}
use of org.springframework.core.ResolvableType in project spring-framework by spring-projects.
the class MessageReaderArgumentResolverTests method map.
@Test
public void map() throws Exception {
String body = "{\"bar\":\"b1\",\"foo\":\"f1\"}";
Map<String, String> map = new HashMap<>();
map.put("foo", "f1");
map.put("bar", "b1");
ResolvableType type = forClassWithGenerics(Map.class, String.class, String.class);
MethodParameter param = this.testMethod.arg(type);
Map<String, String> actual = resolveValue(param, body);
assertEquals(map, actual);
}
use of org.springframework.core.ResolvableType in project spring-framework by spring-projects.
the class MessageReaderArgumentResolverTests method rxJava2ObservableTestBean.
@Test
public void rxJava2ObservableTestBean() throws Exception {
String body = "[{\"bar\":\"b1\",\"foo\":\"f1\"},{\"bar\":\"b2\",\"foo\":\"f2\"}]";
ResolvableType type = forClassWithGenerics(io.reactivex.Observable.class, TestBean.class);
MethodParameter param = this.testMethod.arg(type);
io.reactivex.Observable<?> observable = resolveValue(param, body);
assertEquals(Arrays.asList(new TestBean("f1", "b1"), new TestBean("f2", "b2")), observable.toList().blockingGet());
}
use of org.springframework.core.ResolvableType in project spring-framework by spring-projects.
the class MessageReaderArgumentResolverTests method flowableTestBean.
@Test
public void flowableTestBean() throws Exception {
String body = "[{\"bar\":\"b1\",\"foo\":\"f1\"},{\"bar\":\"b2\",\"foo\":\"f2\"}]";
ResolvableType type = forClassWithGenerics(Flowable.class, TestBean.class);
MethodParameter param = this.testMethod.arg(type);
Flowable<?> flowable = resolveValue(param, body);
assertEquals(Arrays.asList(new TestBean("f1", "b1"), new TestBean("f2", "b2")), flowable.toList().blockingGet());
}
use of org.springframework.core.ResolvableType in project spring-framework by spring-projects.
the class MessageReaderArgumentResolverTests method rxJava2MaybeTestBean.
@Test
public void rxJava2MaybeTestBean() throws Exception {
String body = "{\"bar\":\"b1\",\"foo\":\"f1\"}";
ResolvableType type = forClassWithGenerics(Maybe.class, TestBean.class);
MethodParameter param = this.testMethod.arg(type);
Maybe<TestBean> maybe = resolveValue(param, body);
assertEquals(new TestBean("f1", "b1"), maybe.blockingGet());
}
Aggregations