001    /*
002     * (c) Copyright 2010 University of Bristol
003     * All rights reserved.
004     * [See end of file]
005     */
006    
007    package net.rootdev.javardfa.output;
008    
009    import java.net.URL;
010    import java.util.HashMap;
011    import java.util.Map;
012    import net.rootdev.javardfa.ParserFactory.Format;
013    import org.junit.Test;
014    import static org.junit.Assert.*;
015    
016    /**
017     *
018     * @author pldms
019     */
020    public class OGPReaderTest {
021        
022        /**
023         * Test of getOGP method, of class OGPReader.
024         */
025        @Test
026        public void testGetOGP() throws Exception {
027            URL toLoad = OGPReaderTest.class.getResource("/ogp.html");
028    
029            System.out.println("getOGP");
030            String url = "";
031            Format format = null;
032            Map<String, String> expResult = new HashMap<String, String>();
033            expResult.put("latitude", "37.416343");
034            expResult.put("longitude", "-122.153013");
035            expResult.put("street-address", "1601 S California Ave");
036            expResult.put("locality", "Palo Alto");
037            expResult.put("region", "CA");
038            expResult.put("postal-code", "94304");
039            expResult.put("country-name", "USA");
040            expResult.put("http://example.com/ex#foo", "not-ogp");
041            Map<String, String> result = OGPReader.getOGP(toLoad.toExternalForm(), Format.HTML);
042            assertEquals(expResult, result);
043        }
044    
045    }
046    
047    /*
048     * (c) Copyright 2009 University of Bristol
049     * All rights reserved.
050     *
051     * Redistribution and use in source and binary forms, with or without
052     * modification, are permitted provided that the following conditions
053     * are met:
054     * 1. Redistributions of source code must retain the above copyright
055     *    notice, this list of conditions and the following disclaimer.
056     * 2. Redistributions in binary form must reproduce the above copyright
057     *    notice, this list of conditions and the following disclaimer in the
058     *    documentation and/or other materials provided with the distribution.
059     * 3. The name of the author may not be used to endorse or promote products
060     *    derived from this software without specific prior written permission.
061     *
062     * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
063     * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
064     * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
065     * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
066     * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
067     * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
068     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
069     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
070     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
071     * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
072     */