1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements.  See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License.  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
17package org.apache.harmony.nio.tests.java.nio.channels;
18
19import dalvik.annotation.TestTargetNew;
20import dalvik.annotation.TestLevel;
21import dalvik.annotation.TestTargetClass;
22
23import java.nio.channels.FileChannel;
24
25import junit.framework.TestCase;
26
27/**
28 * Tests for FileChannel.MapMode
29 */
30@TestTargetClass(java.nio.channels.FileChannel.MapMode.class)
31public class MapModeTest extends TestCase {
32
33    /**
34     * java.nio.channels.FileChannel.MapMode#PRIVATE,READONLY,READWRITE
35     */
36    @TestTargetNew(
37        level = TestLevel.COMPLETE,
38        notes = "Verifies fields.",
39        method = "!Constants",
40        args = {}
41    )
42    public void test_PRIVATE_READONLY_READWRITE() {
43        assertNotNull(FileChannel.MapMode.PRIVATE);
44        assertNotNull(FileChannel.MapMode.READ_ONLY);
45        assertNotNull(FileChannel.MapMode.READ_WRITE);
46
47        assertFalse(FileChannel.MapMode.PRIVATE
48                .equals(FileChannel.MapMode.READ_ONLY));
49        assertFalse(FileChannel.MapMode.PRIVATE
50                .equals(FileChannel.MapMode.READ_WRITE));
51        assertFalse(FileChannel.MapMode.READ_ONLY
52                .equals(FileChannel.MapMode.READ_WRITE));
53    }
54
55    /**
56     * java.nio.channels.FileChannel.MapMode#toString()
57     */
58    @TestTargetNew(
59        level = TestLevel.COMPLETE,
60        notes = "",
61        method = "toString",
62        args = {}
63    )
64    public void test_toString() {
65        assertNotNull(FileChannel.MapMode.PRIVATE.toString());
66        assertNotNull(FileChannel.MapMode.READ_ONLY.toString());
67        assertNotNull(FileChannel.MapMode.READ_WRITE.toString());
68    }
69}
70