|
| 1 | +/* |
| 2 | + * Copyright 2005-2016 the original author or authors. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package org.springframework.ldap.filter; |
| 18 | + |
| 19 | +import com.gargoylesoftware.base.testing.EqualsTester; |
| 20 | +import org.junit.Test; |
| 21 | + |
| 22 | +import static org.assertj.core.api.Assertions.assertThat; |
| 23 | + |
| 24 | +/** |
| 25 | + * @author Moritz Kobel |
| 26 | + */ |
| 27 | +public class ProximityFilterTests { |
| 28 | + |
| 29 | + @Test |
| 30 | + public void testEncode() { |
| 31 | + |
| 32 | + EqualsFilter eqq = new ProximityFilter("foo", "*bar(fie)"); |
| 33 | + |
| 34 | + StringBuffer buff = new StringBuffer(); |
| 35 | + eqq.encode(buff); |
| 36 | + |
| 37 | + assertThat(buff.toString()).isEqualTo("(foo~=\\2abar\\28fie\\29)"); |
| 38 | + |
| 39 | + } |
| 40 | + |
| 41 | + @Test |
| 42 | + public void testEquals() { |
| 43 | + ProximityFilter originalObject = new ProximityFilter("a", "b"); |
| 44 | + ProximityFilter identicalObject = new ProximityFilter("a", "b"); |
| 45 | + ProximityFilter differentObject = new ProximityFilter("b", "b"); |
| 46 | + ProximityFilter subclassObject = new ProximityFilter("a", "b") { |
| 47 | + }; |
| 48 | + |
| 49 | + new EqualsTester(originalObject, identicalObject, differentObject, subclassObject); |
| 50 | + } |
| 51 | + |
| 52 | +} |
0 commit comments