@Test
public void alloc3() {
Exception ex = null;
try {
ParentTest.client.alloc(ns1);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
ex=e;
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
String msg = sw.toString();
String exp = "Unable to get the corresponding sharding information according to namespace";
Assert.assertNotEquals(-1, msg.indexOf(exp));
}
finally {
Assert.assertNotNull(ex);
}
}
来自 <http://lxw198902165221.blog.163.com/blog/static/258950022201711794136242/>