VirtualListViewRequestControl extends AbstractControl implements RequestControl { @Override public byte[] encode() { final List<DEREncoder> l = new ArrayList<>(); if (getAssertionValue() != null) { l.add(new IntegerType(getBeforeCount())); l.add(new IntegerType(getAfterCount())); l.add(new OctetStringType(new ContextDERTag(1, false), getAssertionValue())); if (getContextID() != null) { l.add(new OctetStringType(getContextID())); } } else { l.add(new IntegerType(getBeforeCount())); l.add(new IntegerType(getAfterCount())); l.add( new ConstructedDEREncoder( new ContextDERTag(0, true), new IntegerType(getTargetOffset()), new IntegerType(getContentCount()))); if (getContextID() != null) { l.add(new OctetStringType(getContextID())); } } final ConstructedDEREncoder se = new ConstructedDEREncoder( UniversalDERTag.SEQ, l.toArray(new DEREncoder[0])); return se.encode(); } VirtualListViewRequestControl();  VirtualListViewRequestControl(final int offset, final int before, final int after);  VirtualListViewRequestControl(final int offset, final int before, final int after, final boolean critical);  VirtualListViewRequestControl(
    final int offset,
    final int before,
    final int after,
    final int count,
    final byte[] context);  VirtualListViewRequestControl(
    final int offset,
    final int before,
    final int after,
    final int count,
    final byte[] context,
    final boolean critical);  VirtualListViewRequestControl(final String assertion, final int before, final int after);  VirtualListViewRequestControl(
    final String assertion,
    final int before,
    final int after,
    final boolean critical);  VirtualListViewRequestControl(final String assertion, final int before, final int after, final byte[] context);  VirtualListViewRequestControl(
    final String assertion,
    final int before,
    final int after,
    final byte[] context,
    final boolean critical); @Override boolean hasValue(); int getBeforeCount(); void setBeforeCount(final int count); int getAfterCount(); void setAfterCount(final int count); int getTargetOffset(); void setTargetOffset(final int offset); int getContentCount(); void setContentCount(final int count); String getAssertionValue(); void setAssertionValue(final String value); byte[] getContextID(); void setContextID(final byte[] id); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); @Override byte[] encode(); static final String OID; }
@Test(groups = "control", dataProvider = "request") public void encode(final byte[] berValue, final VirtualListViewRequestControl expected) throws Exception { Assert.assertEquals(expected.encode(), berValue); }