@@ -0,0 +1,2585 @@
+/*%0A * Copyright (C) 2010-2014 Hamburg Sud and the contributors.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.aludratest.util.validator;%0A%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport org.junit.Test;%0A%0A/** Tests the %7B@link NumberStringEqualsValidator%7D.%0A * @author falbrech */%0A@SuppressWarnings(%22javadoc%22)%0Apublic class NumberStringEqualsValidatorTest extends AbstractValidatorTest %7B%0A%0A    @Test%0A    public void testPositive() %7B%0A        NumberStringEqualsValidator validator = new NumberStringEqualsValidator(%224.5%22, 1);%0A        assertTrue(validator.valid(%224.5%22));%0A        assertTrue(validator.valid(%224.6%22));%0A        assertTrue(validator.valid(%223.51%22));%0A        assertTrue(validator.valid(%225.49%22));%0A        validator = new NumberStringEqualsValidator(%224.5%22, 0.001);%0A        assertTrue(validator.valid(%224.5%22));%0A        assertTrue(validator.valid(%224.49999%22));%0A        assertTrue(validator.valid(%224.50001%22));%0A    %7D%0A%0A    @Test%0A    public void testNegative() %7B%0A        NumberStringEqualsValidator validator = new NumberStringEqualsValidator(%224.5%22, 1);%0A        assertFalse(validator.valid(%223.4%22));%0A        assertFalse(validator.valid(%225.6%22));%0A        validator = new NumberStringEqualsValidator(%224.5%22, 0.001);%0A        assertFalse(validator.valid(%224.6%22));%0A        assertFalse(validator.valid(%224.4%22));%0A        assertFalse(validator.valid(%224.51%22));%0A        assertFalse(validator.valid(%224.49%22));%0A    %7D%0A%0A    @Test%0A    public void testNullArgument() %7B%0A        NumberStringEqualsValidator validator = new NumberStringEqualsValidator(%225%22, 1);%0A        assertFalse(validator.valid(null));%0A    %7D%0A%0A    @Test%0A    public void testNullValidator() %7B%0A        NumberStringEqualsValidator validator = new NumberStringEqualsValidator(null, 1);%0A        assertTrue(validator.valid(%22TEST%22));%0A    %7D%0A%0A    @Test%0A    public void testNullMarkedValidator() %7B%0A        NumberStringEqualsValidator validator = new NumberStringEqualsValidator(NULL_MARKER, 1);%0A        assertTrue(validator.valid(%22TEST%22));%0A        assertTrue(validator.valid(%22X%22));%0A    %7D%0A%0A%7D%0A

Test case for NumberStringEqualsValidator