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