ExtensibleFilter implements Filter { @Override public DEREncoder getEncoder() { final DEREncoder[] encoders = new DEREncoder[4]; encoders[0] = matchingRuleID != null ? new OctetStringType(new ContextDERTag(1, false), matchingRuleID) : null; encoders[1] = attributeDesc != null ? new OctetStringType(new ContextDERTag(2, false), attributeDesc) : null; encoders[2] = assertionValue != null ? new OctetStringType(new ContextDERTag(3, false), assertionValue) : null; encoders[3] = dnAttributes ? new BooleanType(new ContextDERTag(4, false), true) : null; return new ConstructedDEREncoder( new ContextDERTag(Filter.Type.EXTENSIBLE_MATCH.ordinal(), true), Stream.of(encoders).filter(Objects::nonNull).toArray(DEREncoder[]::new)); } ExtensibleFilter(final String matchingRule, final String type, final String value);  ExtensibleFilter(final String matchingRule, final String type, final String value, final boolean dnAttrs);  ExtensibleFilter(final String matchingRule, final String type, final byte[] value);  ExtensibleFilter(final String matchingRule, final String type, final byte[] value, final boolean dnAttrs); String getMatchingRuleID(); String getAttributeDesc(); byte[] getAssertionValue(); boolean getDnAttributes(); @Override DEREncoder getEncoder(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test(dataProvider = "component") public void encode(final ExtensibleFilter filter, final byte[] berValue) throws Exception { Assert.assertEquals(filter.getEncoder().encode(), berValue); }