2222import javax .naming .directory .Attribute ;
2323import javax .naming .directory .Attributes ;
2424
25- import junit .framework .Assert ;
26-
2725import org .springframework .ldap .core .AttributesMapper ;
26+ import org .springframework .util .Assert ;
2827
2928/**
3029 * Dummy AttributesMapper for testing purposes to check that the received Attributes are
@@ -41,16 +40,21 @@ public class AttributeCheckAttributesMapper implements AttributesMapper<Object>
4140 private String [] absentAttributes = new String [0 ];
4241
4342 public Object mapFromAttributes (Attributes attributes ) throws NamingException {
44- Assert .assertEquals ("Values and attributes need to have the same length " , this .expectedAttributes .length ,
45- this .expectedValues .length );
43+ Assert .isTrue (this .expectedAttributes .length == this .expectedValues .length ,
44+ "Values and attributes need to have the same length " + this .expectedAttributes .length + "!="
45+ + this .expectedValues .length );
46+
4647 for (int i = 0 ; i < this .expectedAttributes .length ; i ++) {
4748 Attribute attribute = attributes .get (this .expectedAttributes [i ]);
48- Assert .assertNotNull ("Attribute " + this .expectedAttributes [i ] + " was not present" , attribute );
49- Assert .assertEquals (this .expectedValues [i ], attribute .get ());
49+
50+ Assert .notNull (attribute , "Attribute " + this .expectedAttributes [i ] + " was not present" );
51+
52+ Assert .isTrue (attribute .get ().equals (this .expectedValues [i ]), "Attribute " + this .expectedAttributes [i ]
53+ + " had value " + attribute .get () + " instead of " + this .expectedValues [i ]);
5054 }
5155
5256 for (String absentAttribute : this .absentAttributes ) {
53- Assert .assertNull (attributes .get (absentAttribute ));
57+ Assert .isNull (attributes .get (absentAttribute ), "Attribute " + absentAttribute + " was present" );
5458 }
5559
5660 return new Object ();
0 commit comments