use of org.testng.annotations.Test in project weixin-java-tools by chanjarster.
the class WxMpMessageRouterTest method testSessionClean3.
@Test(dataProvider = "standardSessionManager")
public void testSessionClean3(StandardSessionManager ism) throws InterruptedException {
// 2个异步请求,看是否处理完毕后会被清理掉
final WxMpMessageRouter router = new WxMpMessageRouter(null);
router.setSessionManager(ism);
router.rule().async(true).handler(new WxSessionMessageHandler()).next().rule().async(true).handler(new WxSessionMessageHandler()).end();
WxMpXmlMessage msg = new WxMpXmlMessage();
msg.setFromUserName("abc");
router.route(msg);
Thread.sleep(2000l);
Assert.assertEquals(ism.getActiveSessions(), 0);
}
use of org.testng.annotations.Test in project che by eclipse.
the class UrlUtilsTest method shouldExtractParametersWithMultipleValuesDividedAnotherParameters.
@Test
public void shouldExtractParametersWithMultipleValuesDividedAnotherParameters() throws Exception {
Map<String, List<String>> expectedParams = new HashMap<>();
List<String> v = new LinkedList<>();
v.add("123");
v.add("qwe");
v.add("www");
List<String> par = new LinkedList<>();
par.add("test");
expectedParams.put("v", v);
expectedParams.put("par", par);
Map<String, List<String>> params = UrlUtils.getQueryParameters(new URL("http://codenvy.com/factory?v=123&par=test&v=qwe&v=www"));
assertEquals(params, expectedParams);
}
use of org.testng.annotations.Test in project che by eclipse.
the class UrlUtilsTest method shouldIgnoreSlashAtTheEndOfPath.
@Test
public void shouldIgnoreSlashAtTheEndOfPath() throws Exception {
Map<String, List<String>> expectedParams = new HashMap<>();
List<String> v = new LinkedList<>();
v.add("123");
v.add("qwe");
v.add("www");
List<String> par = new LinkedList<>();
par.add("test");
expectedParams.put("v", v);
expectedParams.put("par", par);
Map<String, List<String>> params = UrlUtils.getQueryParameters(new URL("http://codenvy.com/factory/?v=123&par=test&v=qwe&v=www"));
assertEquals(params, expectedParams);
}
use of org.testng.annotations.Test in project che by eclipse.
the class ZipUtilsTest method testGetResources.
@Test
public void testGetResources() throws Exception {
URL testJar = ZipUtilsTest.class.getResource("/che/che.jar");
@SuppressWarnings("unchecked") Consumer<InputStream> consumer = mock(Consumer.class);
ZipUtils.getResources(new ZipFile(testJar.getFile()), Pattern.compile(".*[//]?codenvy/[^//]+[.]json"), consumer);
verify(consumer, times(2)).accept(any(InputStream.class));
}
use of org.testng.annotations.Test in project che by eclipse.
the class XMLTreeTest method shouldBeAbleToCreateTreeFromPath.
@Test
public void shouldBeAbleToCreateTreeFromPath() throws Exception {
final byte[] bytes = XML_CONTENT.getBytes();
final Path path = targetDir().resolve("test-xml.xml");
write(path, bytes);
final XMLTree tree = XMLTree.from(path);
assertEquals(tree.getBytes(), bytes);
delete(path);
}
Aggregations