VirtualListViewControlDirContextProcessor extends AbstractFallbackRequestAndResponseControlDirContextProcessor { public Control createRequestControl() { Control control; if (offsetPercentage) { control = super.createRequestControl( new Class[] { int.class, int.class, boolean.class }, new Object[] { Integer.valueOf(targetOffset), Integer.valueOf(pageSize), Boolean.valueOf(CRITICAL_CONTROL) } ); } else { control = super.createRequestControl( new Class[] { int.class, int.class, int.class, int.class, boolean.class }, new Object[] { Integer.valueOf(targetOffset), Integer.valueOf(listSize), Integer.valueOf(0), Integer.valueOf(pageSize - 1), Boolean.valueOf(CRITICAL_CONTROL) } ); } if (cookie != null) { invokeMethod( "setContextID", requestControlClass, control, new Class[] {byte[].class}, new Object[] {cookie.getCookie()} ); } return control; } VirtualListViewControlDirContextProcessor(int pageSize);  VirtualListViewControlDirContextProcessor(int pageSize,
            int targetOffset, int listSize, VirtualListViewResultsCookie cookie); VirtualListViewResultsCookie getCookie(); int getPageSize(); int getListSize(); NamingException getException(); int getTargetOffset(); void setOffsetPercentage(boolean isPercentage); boolean isOffsetPercentage(); Control createRequestControl();  }
@Test public void testCreateRequestControlWithTargetAsOffset() throws Exception { int pageSize = 5; int targetOffset = 25; int listSize = 1000; VirtualListViewControlDirContextProcessor tested = new VirtualListViewControlDirContextProcessor( pageSize, targetOffset, listSize, new VirtualListViewResultsCookie(new byte[0], 0, 0)); VirtualListViewControl result = (VirtualListViewControl) tested .createRequestControl(); assertThat(result).isNotNull(); assertThat(result.getID()).isEqualTo(OID_REQUEST); int expectedBeforeCount = 0; int expectedAfterCount = 4; int expectedOffset = 25; int expectedContentCount = listSize; assertEncodedRequest(result.getEncodedValue(), expectedBeforeCount, expectedAfterCount, expectedOffset, expectedContentCount, new byte[0]); }