package com.ozs.account;

import java.io.UnsupportedEncodingException;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

import com.ozs.account.controller.AccountInfoController;

@RunWith(SpringRunner.class)
@SpringBootTest
public class AccountApplicationTests {
    
    @Autowired
    private AccountInfoController capAccountInfoController;
    
    private MockMvc mockMvc;
    
    @Before
    public void setUp() {
        mockMvc = MockMvcBuilders.standaloneSetup(capAccountInfoController).build();
    }
    
	@Test
	public void contextLoads() {
	    try {
            ResultActions result = mockMvc.perform(MockMvcRequestBuilders.get("/accountInfo/getAccountInfoById?accountId=999999"));
            String res = result.andReturn().getResponse().getContentAsString();
            System.out.println(res);
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
	}

}
