SubstringFilter implements Filter { @Override public DEREncoder getEncoder() { final DEREncoder[] encoders = new DEREncoder[getAssertionCount()]; int i = 0; if (subInitial != null) { encoders[i++] = new OctetStringType( new ContextDERTag(Substrings.INITIAL.ordinal(), false), subInitial); } if (subAny != null && subAny.length > 0) { for (byte[] assertion : subAny) { encoders[i++] = new OctetStringType(new ContextDERTag(Substrings.ANY.ordinal(), false), assertion); } } if (subFinal != null) { encoders[i] = new OctetStringType( new ContextDERTag(Substrings.FINAL.ordinal(), false), subFinal); } return new ConstructedDEREncoder( new ContextDERTag(Filter.Type.SUBSTRING.ordinal(), true), new OctetStringType(attributeDesc), new ConstructedDEREncoder( UniversalDERTag.SEQ, encoders)); } SubstringFilter(final String name, final String startsWith, final String endsWith, final String... contains);  SubstringFilter(final String name, final byte[] startsWith, final byte[] endsWith, final byte[]... contains); String getAttributeDesc(); byte[] getSubInitial(); byte[][] getSubAny(); byte[] getSubFinal(); @Override DEREncoder getEncoder(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test(dataProvider = "component") public void encode(final SubstringFilter filter, final byte[] berValue) throws Exception { Assert.assertEquals(filter.getEncoder().encode(), berValue); }