/**
  * Test SetIncludeAttribute method of LDIFChangeRecordWriter Throws a NullPointerException if the
  * attributeDescription is null.
  *
  * @throws Exception If the test failed unexpectedly.
  */
 @Test(expectedExceptions = NullPointerException.class)
 public void testSetIncludeAttributeDoesntAllowNull() throws Exception {
   final List<String> actual = new ArrayList<>();
   final LDIFChangeRecordWriter writer = new LDIFChangeRecordWriter(actual);
   try {
     writer.setIncludeAttribute(null);
   } finally {
     writer.close();
   }
 }
  /**
   * Test SetIncludeAttribute method of LDIFChangeRecordWriter. Inserting attribute cn (common name)
   * & sn (surname)
   *
   * @throws Exception If the test failed unexpectedly.
   */
  @Test
  public void testSetIncludeAttributeWithNoMatch() throws Exception {
    final List<String> actual = new ArrayList<>();
    final LDIFChangeRecordWriter writer = new LDIFChangeRecordWriter(actual);

    final AddRequest changeRequest = Requests.newAddRequest(getAddLDIFChangeRecord());

    writer.setIncludeAttribute(AttributeDescription.valueOf("vip"));
    writer.writeChangeRecord(changeRequest);
    writer.close();

    assertThat(actual.get(0)).isEqualTo("dn: uid=scarter,ou=People,dc=example,dc=com");
    assertThat(actual.get(1)).isEqualTo("changetype: add");
    assertThat(actual.get(2)).contains("");
  }