@Test public void intValueIsCheckedAsString() throws Exception { BasicAttributes entity = new BasicAttributes(true); entity.put("userPassword", 3); setField(entityFacade, entityFacade.getClass().getDeclaredField("entity"), entity); entityFacade.entityHasAttributeWithValue("userpassword", "3"); }
public void entityHasAttributeWithValue(String expectedAttr, String expectedValue) { Attribute actualAttr = getNotNullAttribute(expectedAttr); List<String> attributesList = new ArrayList<>(); for (int i = 0; i < actualAttr.size(); i++) { try { attributesList.add(toString(actualAttr.get(i))); } catch (NamingException e) { throw new CukesRuntimeException(e); } } assertThat("Should have attribute '" + expectedAttr + "' with value '" + expectedValue + "'", attributesList, hasItem(expectedValue)); }
EntityFacade { public void entityHasAttributeWithValue(String expectedAttr, String expectedValue) { Attribute actualAttr = getNotNullAttribute(expectedAttr); List<String> attributesList = new ArrayList<>(); for (int i = 0; i < actualAttr.size(); i++) { try { attributesList.add(toString(actualAttr.get(i))); } catch (NamingException e) { throw new CukesRuntimeException(e); } } assertThat("Should have attribute '" + expectedAttr + "' with value '" + expectedValue + "'", attributesList, hasItem(expectedValue)); } }
EntityFacade { public void entityHasAttributeWithValue(String expectedAttr, String expectedValue) { Attribute actualAttr = getNotNullAttribute(expectedAttr); List<String> attributesList = new ArrayList<>(); for (int i = 0; i < actualAttr.size(); i++) { try { attributesList.add(toString(actualAttr.get(i))); } catch (NamingException e) { throw new CukesRuntimeException(e); } } assertThat("Should have attribute '" + expectedAttr + "' with value '" + expectedValue + "'", attributesList, hasItem(expectedValue)); }  }
EntityFacade { public void entityHasAttributeWithValue(String expectedAttr, String expectedValue) { Attribute actualAttr = getNotNullAttribute(expectedAttr); List<String> attributesList = new ArrayList<>(); for (int i = 0; i < actualAttr.size(); i++) { try { attributesList.add(toString(actualAttr.get(i))); } catch (NamingException e) { throw new CukesRuntimeException(e); } } assertThat("Should have attribute '" + expectedAttr + "' with value '" + expectedValue + "'", attributesList, hasItem(expectedValue)); }  void initConfiguration(); void readEntityByDn(String dn); void entityExists(); void entityDoesNotExist(); void deleteEntityByDn(String dn); void entityHasAttributeWithValueOtherThat(String attribute, String value); Attribute getNotNullAttribute(String attribute); void entityContainsAttribute(String attribute); void entityDoesNotContainAttribute(String attribute); Attribute getAttribute(String attribute); void entityHasAttributeAsArrayOfSize(String attribute, String operator, int size); void entityHasAttributeWithValueMatchingPattern(String attribute, String pattern); void entityHasAttributeWithValueNotMatchingPattern(String attribute, String pattern); void importLdif(String ldif); void importLdifFromFile(String ldifFile); void entityMatchesLDIF(String ldif); void entityHasAttributeWithValue(String expectedAttr, String expectedValue); void searchByFilter(String dn, String filter); void searchResultHasSize(String operator, int size); void takeEntityFromSearchResults(int index); }
EntityFacade { public void entityHasAttributeWithValue(String expectedAttr, String expectedValue) { Attribute actualAttr = getNotNullAttribute(expectedAttr); List<String> attributesList = new ArrayList<>(); for (int i = 0; i < actualAttr.size(); i++) { try { attributesList.add(toString(actualAttr.get(i))); } catch (NamingException e) { throw new CukesRuntimeException(e); } } assertThat("Should have attribute '" + expectedAttr + "' with value '" + expectedValue + "'", attributesList, hasItem(expectedValue)); }  void initConfiguration(); void readEntityByDn(String dn); void entityExists(); void entityDoesNotExist(); void deleteEntityByDn(String dn); void entityHasAttributeWithValueOtherThat(String attribute, String value); Attribute getNotNullAttribute(String attribute); void entityContainsAttribute(String attribute); void entityDoesNotContainAttribute(String attribute); Attribute getAttribute(String attribute); void entityHasAttributeAsArrayOfSize(String attribute, String operator, int size); void entityHasAttributeWithValueMatchingPattern(String attribute, String pattern); void entityHasAttributeWithValueNotMatchingPattern(String attribute, String pattern); void importLdif(String ldif); void importLdifFromFile(String ldifFile); void entityMatchesLDIF(String ldif); void entityHasAttributeWithValue(String expectedAttr, String expectedValue); void searchByFilter(String dn, String filter); void searchResultHasSize(String operator, int size); void takeEntityFromSearchResults(int index);  }