/tst/org/diffkit/db/tst/TestDBColumn.groovy

http://diffkit.googlecode.com/ · Groovy · 44 lines · 19 code · 7 blank · 18 comment · 4 complexity · 82af33df33812e306ec43ca5fd97ff3a 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.db.tst
  17. import org.diffkit.db.DKDBColumn
  18. import org.diffkit.db.DKDBType;
  19. import org.diffkit.db.DKDBTypeInfo;
  20. import groovy.util.GroovyTestCase;
  21. /**
  22. * @author jpanico
  23. */
  24. public class TestDBColumn extends GroovyTestCase {
  25. public void testCompareTo(){
  26. DKDBColumn[] columns = new DKDBColumn[4]
  27. columns[0] = new DKDBColumn('col4',4,'VARCHAR',-1,false)
  28. columns[1] = new DKDBColumn('col1',1,'VARCHAR',-1,false)
  29. columns[2] = new DKDBColumn('col3',3,'VARCHAR',-1,false)
  30. columns[3] = new DKDBColumn('col2',2,'VARCHAR',-1,false)
  31. Arrays.sort(columns)
  32. assert columns[0].ordinalPosition == 1
  33. assert columns[1].ordinalPosition == 2
  34. assert columns[2].ordinalPosition == 3
  35. assert columns[3].ordinalPosition == 4
  36. }
  37. }