package com.digi;

import com.digi.entity.request.AccountToVerify;
import com.digi.util.JsonUtil;
import org.hamcrest.core.IsNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.RequestBuilder;


import static io.jsonwebtoken.lang.Strings.hasLength;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;


/**
 * Created by tymoshenkol on 07-Oct-16.
 */
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class TwilioSendTest {
	@Autowired
	private MockMvc mockMvc;

	@Test
	public void testSendAdminSms () throws Exception {

		this.mockMvc.perform(get("/sms/admin"))
				.andDo(print())
				.andExpect(status().isOk())

				.andExpect(jsonPath("$.errorCode").value(IsNull.nullValue()))

				.andExpect(jsonPath("$.sid").value(IsNull.notNullValue()))
				.andExpect(jsonPath("$.sid").isString())
				.andExpect(jsonPath("$.sid").isNotEmpty())

				.andExpect(jsonPath("$.status").value("QUEUED"))
				.andExpect(jsonPath("$.numMedia").value("0"))
				.andExpect(jsonPath("$.numSegments").value("1"));
	}


}

@@ -16,87 +16,8 @@
 i;%0A%0A
-import com.digi.entity.request.AccountToVerify;%0Aimport com.digi.util.JsonUtil;%0A
 impo
@@ -314,51 +314,8 @@
 st;%0A
-import org.springframework.http.MediaType;%0A
 impo
@@ -428,123 +428,8 @@
 vc;%0A
-import org.springframework.test.web.servlet.RequestBuilder;%0A%0A%0Aimport static io.jsonwebtoken.lang.Strings.hasLength;
 %0Aimp
@@ -603,97 +603,8 @@
 nt;%0A
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;%0A
 impo

send message to admin