@@ -0,0 +1,2329 @@
+package com.twilio.ivrrecording.servlet.extension;%0A%0Aimport com.twilio.ivrrecording.models.Agent;%0Aimport com.twilio.ivrrecording.repositories.AgentRepository;%0Aimport com.twilio.ivrrecording.servlet.BaseTwilioServletTest;%0Aimport com.twilio.ivrrecording.servlet.menu.ShowServlet;%0Aimport org.hamcrest.CoreMatchers;%0Aimport org.jdom2.Document;%0Aimport org.jdom2.Element;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.Mock;%0Aimport org.mockito.MockitoAnnotations;%0A%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.PrintWriter;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport static org.hamcrest.CoreMatchers.equalTo;%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.junit.Assert.*;%0Aimport static org.mockito.Matchers.anyString;%0Aimport static org.mockito.Mockito.when;%0A%0Apublic class ConnectServletTest extends BaseTwilioServletTest %7B%0A    @Mock%0A    HttpServletRequest request;%0A%0A    @Mock%0A    HttpServletResponse response;%0A%0A    @Mock%0A    AgentRepository agentRepository;%0A%0A    @Before%0A    public void setUp() throws IOException %7B%0A        MockitoAnnotations.initMocks(this);%0A    %7D%0A%0A    @Test%0A    public void postMethod_WhenAnAgentIsFound_ThenRespondsByDialingTheAgentsPhoneNumber()%0A            throws Exception %7B%0A        ByteArrayOutputStream output = new ByteArrayOutputStream();%0A        PrintWriter printWriter = new PrintWriter(output);%0A%0A        String number = %22+12025550142%22;%0A%0A        when(agentRepository.findByExtension(anyString())).thenReturn(new Agent(1, %22Brodo%22, number));%0A        when(request.getParameter(%22Digits%22)).thenReturn(%222%22);%0A        when(response.getWriter()).thenReturn(printWriter);%0A%0A        ConnectServlet servlet = new ConnectServlet(agentRepository);%0A        servlet.doPost(request, response);%0A%0A        printWriter.flush();%0A        String content = new String(output.toByteArray(), %22UTF-8%22);%0A%0A        Document document = getDocument(content);%0A%0A        assertThatContentTypeIsXML(response);%0A        assertThat(getAttributeValue(document, %22Dial/Number%22, %22url%22), is(equalTo(%22/agents/screen-call%22)));%0A        assertThat(getElement(document, %22Dial/Number%22).getValue(), is(equalTo(number)));%0A    %7D%0A%0A%7D

Add Connect Servlets, tests and some code refactoring