/*
 * Copyright (C) 2008 feilong
 *
 * Licensed 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 com.feilong.core.util.resourcebundleutiltest;

import static org.hamcrest.Matchers.hasKey;
import static org.junit.Assert.assertThat;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ResourceBundle;

import org.junit.Ignore;
import org.junit.Test;

import static com.feilong.core.util.ResourceBundleUtil.getResourceBundle;
import static com.feilong.core.util.ResourceBundleUtil.toMap;

/**
 * The Class ResourceBundleUtilGetResourceBundleWithInputStreamTest.
 *
 * @author <a href="http://feitianbenyue.iteye.com/">feilong</a>
 */
public class ResourceBundleUtilGetResourceBundleWithInputStreamTest{

    /**
     * Test get resource bundle null input stream.
     */
    @Test(expected = NullPointerException.class)
    public void testGetResourceBundleNullInputStream(){
        getResourceBundle((InputStream) null);
    }

    /**
     * Test get resource bundle.
     *
     * @throws FileNotFoundException
     *             the file not found exception
     */
    @Test()
    @Ignore
    public void testGetResourceBundle() throws FileNotFoundException{
        FileInputStream inputStream = new FileInputStream("E:\\DataCommon\\Files\\Java\\config\\mail-read.properties");
        ResourceBundle resourceBundle = getResourceBundle(inputStream);
        assertThat(toMap(resourceBundle), hasKey("incoming.pop.hostname"));
    }

}

@@ -739,40 +739,8 @@
 t;%0A%0A
-import java.io.FileInputStream;%0A
 impo
@@ -856,23 +856,22 @@
 nit.
-Ignore;
+Test;%0A
 %0Aimport 
 org.
@@ -862,38 +862,61 @@
 st;%0A%0Aimport 
-org.junit.Test
+com.feilong.core.lang.ClassLoaderUtil
 ;%0A%0Aimport st
@@ -1641,16 +1641,18 @@
 t()%0A    
+//
 @Ignore%0A
@@ -1729,20 +1729,18 @@
         
-File
+//
 InputStr
@@ -1839,16 +1839,241 @@
 ties%22);%0A
+%0A        InputStream inputStream = ClassLoaderUtil.getResourceAsStream(%0A                        %22messages/feilong-core-test.properties%22,%0A                        ResourceBundleUtilGetResourceBundleWithInputStreamTest.class);%0A%0A
         
@@ -2144,16 +2144,18 @@
         
+//
 assertTh
@@ -2214,16 +2214,85 @@
 ame%22));%0A
+        assertThat(toMap(resourceBundle), hasKey(%22FileType.image%22));%0A
     %7D%0A%0A%7D

update test fix #558