PageRenderTime 27ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/com/google/appengine/datanucleus/TypeConversionUtilsTest.java

http://datanucleus-appengine.googlecode.com/
Java | 48 lines | 22 code | 8 blank | 18 comment | 0 complexity | 709d720d42b46ddf4243e52bd923e553 MD5 | raw file
Possible License(s): Apache-2.0
  1. /**********************************************************************
  2. Copyright (c) 2009 Google Inc.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. **********************************************************************/
  13. package com.google.appengine.datanucleus;
  14. import junit.framework.TestCase;
  15. import com.google.appengine.datanucleus.test.jdo.HasEnumJDO;
  16. import java.util.Arrays;
  17. /**
  18. * @author Max Ross <maxr@google.com>
  19. */
  20. public class TypeConversionUtilsTest extends TestCase {
  21. public void testNullToArray() {
  22. TypeConversionUtils tcu = new TypeConversionUtils(true);
  23. @SuppressWarnings("unused")
  24. String[] stringArray =
  25. (String[]) tcu.convertDatastoreListToPojoArray(null, String.class);
  26. @SuppressWarnings("unused")
  27. HasEnumJDO.MyEnum[] enumArray = (HasEnumJDO.MyEnum[])
  28. tcu.convertDatastoreListToPojoArray(null, HasEnumJDO.MyEnum.class);
  29. @SuppressWarnings("unused")
  30. int[] intArray =
  31. (int[]) tcu.convertDatastoreListToPojoArray(null, Integer.TYPE);
  32. }
  33. public void testAsListBehavior() {
  34. Byte[] bArray = {0, 5, 8};
  35. assertEquals(3, Arrays.asList(bArray).size());
  36. }
  37. }