/tst/org/diffkit/diff/diffor/tst/TestConvertingDiffor.groovy

http://diffkit.googlecode.com/ · Groovy · 44 lines · 15 code · 11 blank · 18 comment · 1 complexity · 0c1efa77c5d3f86f618dae9c40187032 MD5 · raw file

  1. /**
  2. * Copyright 2010-2011 Joseph Panico
  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. * http://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. package org.diffkit.diff.diffor.tst
  17. import groovy.util.GroovyTestCase;
  18. import org.apache.commons.beanutils.converters.IntegerConverter
  19. import org.diffkit.diff.diffor.DKConvertingDiffor
  20. import org.diffkit.diff.diffor.DKEqualsDiffor;
  21. /**
  22. * @author jpanico
  23. */
  24. public class TestConvertingDiffor extends GroovyTestCase {
  25. public void testDiff(){
  26. DKConvertingDiffor diffor = [null, Long.class, DKEqualsDiffor.instance]
  27. assert ! diffor.isDiff(new Long(1234), '1234', null)
  28. }
  29. public void testConvert(){
  30. assert new IntegerConverter(true).convert(Long.class, '1234') == 1234
  31. assert new BigDecimal(1).equals(new BigDecimal(1))
  32. }
  33. }