View Javadoc

1   /**
2    * Copyright 2012 The Kuali Foundation
3    *
4    * Licensed under the the Educational Community License, Version 1.0
5    * (the "License"); you may not use this file except in compliance
6    * with the License.  You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl1.php
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  package org.kuali.student.common.test.util;
17  
18  
19  import static org.junit.Assert.*;
20  
21  /**
22   * @author ocleirig
23   *
24   */
25  public class FloatAsStringTester {
26  
27      /**
28       * 
29       */
30      public FloatAsStringTester() {
31      }
32  
33      public void check(String expected, String actual) {
34  
35          if (expected == null && actual == null) {
36              return;
37          }
38          if (expected == null) {
39              fail("expected null but found " + actual);
40          }
41          if (actual == null) {
42              fail("expected " + expected + " but found null");
43          }
44          Float expFloat = Float.parseFloat(expected);
45          Float actFloat = Float.parseFloat(actual);
46          assertEquals(expFloat, actFloat);
47      }
48  }