package com.github.cstroe.spendhawk.web.it;

import com.github.cstroe.spendhawk.testutil.web.DBUnitServlet;
import com.github.cstroe.spendhawk.web.AccountServlet;
import com.github.cstroe.spendhawk.web.BaseClientIT;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(Arquillian.class)
public class AccountServletIT extends BaseClientIT {

    @Test
    @RunAsClient
    @InSequence(50)
    public void t0050_seed_database() throws Exception {
        response = connect(DBUnitServlet.class);
        assertResponseStatus(200, response);
    }

    @Test
    @RunAsClient
    @InSequence(100)
    public void t0100_can_connect() {
        connect200(AccountServlet.class, "id", 10l, "relDate", "currentMonth");
    }
}

@@ -209,16 +209,84 @@
 ientIT;%0A
+import com.github.cstroe.spendhawk.web.transaction.TransactionView;%0A
 import o
@@ -445,502 +445,1708 @@
 rg.j
-unit.Test;%0Aimport org.junit.runner.RunWith;%0A%0A@RunWith(Arquillian.class)%0Apublic class AccountServletIT extends BaseClientIT %7B%0A%0A    @Test%0A    @RunAsClient%0A    @InSequence(50)%0A    public void t0050_seed_database() throws Exception %7B%0A        response = connect(DBUnitServlet.class);%0A        assertResponseStatus(200, response);%0A    %7D%0A%0A    @Test%0A    @RunAsClient%0A    @InSequence(100)%0A    public void t0100_can_connect() %7B%0A        connect200(AccountServlet.class, %22id%22, 10l, %22relDate%22, %22currentMonth%22
+soup.Jsoup;%0Aimport org.jsoup.nodes.Document;%0Aimport org.jsoup.nodes.Element;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.TestWatcher;%0Aimport org.junit.runner.Description;%0Aimport org.junit.runner.RunWith;%0A%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;%0A%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.junit.Assert.assertThat;%0A%0A@RunWith(Arquillian.class)%0Apublic class AccountServletIT extends BaseClientIT %7B%0A%0A    @Rule%0A    public TestWatcher saveResponse = new TestWatcher() %7B%0A        @Override%0A        protected void failed(Throwable e, Description description) %7B%0A            System.out.println(%22Test name: %22 + description.getMethodName());%0A            saveResponseToFile(response);%0A        %7D%0A    %7D;%0A%0A    @Test%0A    @RunAsClient%0A    @InSequence(50)%0A    public void t0050_seed_database() throws Exception %7B%0A        response = connect(DBUnitServlet.class);%0A        assertResponseStatus(200, response);%0A    %7D%0A%0A    @Test%0A    @RunAsClient%0A    @InSequence(100)%0A    public void t0100_can_connect() %7B%0A        connect200(AccountServlet.class, %22id%22, 10l, %22relDate%22, %22currentMonth%22);%0A    %7D%0A%0A    @Test%0A    @RunAsClient%0A    @InSequence(110)%0A    public void t0110_can_see_all_transactions() %7B%0A        response = connect(AccountServlet.class,%0A            %22id%22, 17l, %22start%22, %2201-01-2015%22, %22end%22, %2201-01-2015%22);%0A%0A        assertResponseStatus(200, response);%0A%0A        Document doc = Jsoup.parse(response.getBody());%0A        List%3CElement%3E transactionLinks = doc.getElementsByTag(%22a%22).stream()%0A            .filter(e -%3E e.attr(%22href%22).contains(servletPath(TransactionView.class)))%0A            .collect(Collectors.toList());%0A%0A        assertThat(transactionLinks.size(), is(3)
 );%0A 

Make sure transaction links show up correctly.