| 468 | } |
| 469 | |
| 470 | @Test |
| 471 | public void header090() throws Exception { |
| 472 | RegionClient rclient = mock(RegionClient.class); |
| 473 | final byte[] buf = new byte[4 + 1 + 4 + 2 + 29 + 2 + 48 + 2 + 47]; |
| 474 | final String klass = "org.apache.hadoop.io.Writable"; |
| 475 | ChannelBuffer header = mock(ChannelBuffer.class); |
| 476 | |
| 477 | PowerMockito.when(rclient, "commonHeader", buf, HRPC3).thenReturn(header); |
| 478 | PowerMockito.when(header, "writerIndex").thenReturn(0); |
| 479 | PowerMockito.when(rclient, "header090").thenCallRealMethod(); |
| 480 | |
| 481 | ChannelBuffer header090 = Whitebox.invokeMethod(rclient, "header090"); |
| 482 | |
| 483 | verifyPrivate(rclient, Mockito.atMost(1)).invoke("commonHeader", buf, HRPC3); |
| 484 | verifyPrivate(header, Mockito.atMost(2)).invoke("writerIndex"); |
| 485 | verifyPrivate(header, Mockito.atLeast(1)) |
| 486 | .invoke("writerIndex", Mockito.anyInt()); |
| 487 | verifyPrivate(header, Mockito.atMost(3)).invoke("writeShort", klass.length()); |
| 488 | verifyPrivate(header, Mockito.atMost(3)) |
| 489 | .invoke("writeBytes", Bytes.ISO88591(klass)); |
| 490 | verifyPrivate(header, Mockito.atMost(1)) |
| 491 | .invoke("setInt", Mockito.eq(5), Mockito.anyInt()); |
| 492 | |
| 493 | assertNotNull(header090); |
| 494 | } |
| 495 | |
| 496 | @Test |
| 497 | public void header092() throws Exception { |