when(am.getZKTable()).thenReturn(new ZKTable(zkw));
Stat stat = new Stat();
String nodeName = ZKAssign.getNodeName(zkw, hri.getEncodedName());
ZKUtil.getDataAndWatch(zkw, nodeName, stat);
// use the version for the OpenedRegionHandler
OpenedRegionHandler handler = new OpenedRegionHandler(server, am, region
.getRegionInfo(), new HServerInfo(new HServerAddress(
new InetSocketAddress(1111)), 0, ""), stat.getVersion());
// Once again overwrite the same znode so that the version changes.
ZKAssign.transitionNode(zkw, region.getRegionInfo(), server
.getServerName(), EventType.RS_ZK_REGION_OPENED,
EventType.RS_ZK_REGION_OPENED, stat.getVersion());
// Should not invoke assignmentmanager.regionOnline. If it is invoked as
// per current mocking it will throw null pointer exception.
boolean expectedException = false;
try {
handler.process();
} catch (Exception e) {
expectedException = true;
}
assertFalse("The process method should not throw any exception.",
expectedException);