/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.apache.harmony.luni.tests.internal.net.www.protocol.file;

import java.io.IOException;
import java.net.URL;

import junit.framework.TestCase;

import org.apache.harmony.luni.internal.net.www.protocol.file.FileURLConnection;

/**
 * Tests for <code>FileURLConnection</code> class constructors and methods.
 */
public class FileURLConnectionTest extends TestCase {

    static String getContentType(String fileName) throws IOException {
        String resourceName = "org/apache/harmony/luni/tests/" + fileName;
        URL url = ClassLoader.getSystemClassLoader().getResource(resourceName);
        assertNotNull("Cannot find test resource " + resourceName, url);
        return new FileURLConnection(url).getContentType();
    }

    public void testGetContentType() throws IOException  {
        // Regression for HARMONY-4699
        assertEquals(getContentType("test.rtf"), "application/rtf");
        assertEquals(getContentType("test.java"), "text/plain");
        // RI would return "content/unknown"
        assertEquals(getContentType("test.doc"), "application/msword");
        assertEquals(getContentType("test.htx"), "text/html");
        assertEquals(getContentType("test.xml"), "application/xml");
        assertEquals(getContentType("."), "text/plain");
    }
}

@@ -1659,32 +1659,51 @@
    assertEquals(
+%22application/rtf%22, 
 getContentType(%22
@@ -1716,27 +1716,8 @@
 tf%22)
-, %22application/rtf%22
 );%0A 
@@ -1728,32 +1728,46 @@
    assertEquals(
+%22text/plain%22, 
 getContentType(%22
@@ -1777,30 +1777,16 @@
 t.java%22)
-, %22text/plain%22
 );%0A     
@@ -1838,32 +1838,54 @@
    assertEquals(
+%22application/msword%22, 
 getContentType(%22
@@ -1898,30 +1898,8 @@
 oc%22)
-, %22application/msword%22
 );%0A 
@@ -1910,32 +1910,45 @@
    assertEquals(
+%22text/html%22, 
 getContentType(%22
@@ -1961,21 +1961,8 @@
 tx%22)
-, %22text/html%22
 );%0A 
@@ -1973,32 +1973,51 @@
    assertEquals(
+%22application/xml%22, 
 getContentType(%22
@@ -2030,27 +2030,8 @@
 ml%22)
-, %22application/xml%22
 );%0A 
@@ -2050,16 +2050,30 @@
 tEquals(
+%22text/plain%22, 
 getConte
@@ -2087,22 +2087,8 @@
 %22.%22)
-, %22text/plain%22
 );%0A 

Fix order of junit arguments spotted in recent commit message.