package com.sakamichi46.api;

import com.sakamichi46.config.ApplicationConfig;
import com.sakamichi46.model.Member;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.ws.rs.core.Response;
import static org.hamcrest.CoreMatchers.is;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import static org.junit.Assert.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * Test for Nogizaka46 API.
 * 
 * @author kikuta
 */
@RunWith(Arquillian.class)
public class Nogizaka46ResourceTest {
    
    @Deployment
    public static JavaArchive createDeployment() {
        return ShrinkWrap.create(JavaArchive.class)
                .addClass(AbstractSakamichi46Resource.class)
                .addClass(HiraganaKeyakiResource.class)
                .addClass(Keyakizaka46Resource.class)
                .addClass(Nogizaka46Resource.class)
                .addClass(ApplicationConfig.class)
                .addClass(Member.class)
                .addAsDirectory("WEB-INF/classes")
                .addAsResource(new File("src/main/webapp/WEB-INF/classes/", "Hiraganakeyaki.json"))
                .addAsResource(new File("src/main/webapp/WEB-INF/classes/", "Keyakizaka46.json"))
                .addAsResource(new File("src/main/webapp/WEB-INF/classes/", "Nogizaka46.json"));
    }
    
    @ArquillianResource
    private URL base;
    
    @Test
    @RunAsClient
    public void Nogizaka46OfficialBlogUrlTest() throws MalformedURLException {
        Response get = ResteasyClientBuilder.newBuilder().build().target(new URL(base, "api/nogizaka46/blog").toExternalForm()).request().get();
        assertThat(get.readEntity(String.class), is("http://www.nogizaka46.com/"));            
    }
}

@@ -1821,16 +1821,368 @@
 ption %7B%0A
+        Response res = ResteasyClientBuilder.newBuilder().build().target(new URL(base, %22api/nogizaka46/blog%22).toExternalForm()).request().get();%0A        assertThat(res.readEntity(String.class), is(%22http://www.nogizaka46.com/%22));%0A    %7D%0A    %0A    @Test%0A    @RunAsClient%0A    public void Nogizaka46OfficialBlogMobileUrlTest() throws MalformedURLException %7B%0A
         
@@ -2272,32 +2272,39 @@
 /nogizaka46/blog
+/mobile
 %22).toExternalFor
@@ -2408,24 +2408,738 @@
 com/
+smph/
 %22));
+%0A
     
+%7D%0A
     
+%0A
     
+@Test%0A    @RunAsClient%0A    public void Nogizaka46OfficialGoodsUrlTest() throws MalformedURLException %7B%0A        Response get = ResteasyClientBuilder.newBuilder().build().target(new URL(base, %22api/nogizaka46/goods%22).toExternalForm()).request().get();%0A        assertThat(get.readEntity(String.class), is(%22http://www.nogizaka46shop.com/%22));%0A    %7D%0A    %0A    @Test%0A    @RunAsClient%0A    public void Nogizaka46OfficialGoodsMobileUrlTest() throws MalformedURLException %7B%0A        Response get = ResteasyClientBuilder.newBuilder().build().target(new URL(base, %22api/nogizaka46/goods/mobile%22).toExternalForm()).request().get();%0A        assertThat(get.readEntity(String.class), is(%22http://www.nogizaka46shop.com/msp/%22));
 %0A   

Add test for Nogizaka46Resource.