use of io.vertx.core.MultiMap in project java-chassis by ServiceComb.
the class TestVertxToServletMockRequest method testGetParameterValues.
@Test
public void testGetParameterValues() {
boolean validAssert = true;
try {
HttpServerRequest httpServerRequest = Mockito.mock(HttpServerRequest.class);
Deencapsulation.setField(instance, "vertxRequest", httpServerRequest);
MultiMap multiMap = Mockito.mock(MultiMap.class);
Mockito.when(httpServerRequest.params()).thenReturn(multiMap);
List<String> stringList = new ArrayList<String>();
stringList.add("sters");
Mockito.when(multiMap.getAll("key")).thenReturn(stringList);
Assert.assertNotNull(instance.getParameterValues("param"));
} catch (Exception e) {
Assert.assertNotNull(e);
validAssert = false;
} catch (Error e) {
Assert.assertNotNull(e);
validAssert = false;
}
Assert.assertTrue(validAssert);
}
use of io.vertx.core.MultiMap in project java-chassis by ServiceComb.
the class TestVertxToServletMockRequest method testGetParameterMap.
@Test
public void testGetParameterMap() {
boolean validAssert = true;
try {
init();
@SuppressWarnings("unused") Map<String, String[]> paramMap = new HashMap<>();
HttpServerRequest httpServerRequest = Mockito.mock(HttpServerRequest.class);
Deencapsulation.setField(instance, "vertxRequest", httpServerRequest);
MultiMap multiMap = Mockito.mock(MultiMap.class);
Mockito.when(httpServerRequest.params()).thenReturn(multiMap);
Set<String> stringSet = new HashSet<String>();
stringSet.add("sters");
Mockito.when(multiMap.names()).thenReturn(stringSet);
Assert.assertNotNull(instance.getParameterMap());
} catch (Exception e) {
Assert.assertNotNull(e);
validAssert = false;
} catch (Error e) {
Assert.assertNotNull(e);
validAssert = false;
}
Assert.assertTrue(validAssert);
}
Aggregations