@@ -0,0 +1,2430 @@
+package annis.gui.exporter;%0A%0Aimport static org.junit.jupiter.api.Assertions.assertEquals;%0Aimport static org.junit.jupiter.api.Assertions.assertNull;%0Aimport static org.mockito.Mockito.mock;%0A%0Aimport annis.SingletonBeanStoreRetrievalStrategy;%0Aimport annis.gui.AnnisUI;%0Aimport com.github.mvysny.kaributesting.v8.MockVaadin;%0Aimport com.google.common.eventbus.EventBus;%0Aimport com.vaadin.spring.internal.UIScopeImpl;%0Aimport java.io.IOException;%0Aimport java.io.StringWriter;%0Aimport java.io.Writer;%0Aimport java.util.HashMap;%0Aimport org.corpus_tools.annis.api.model.QueryLanguage;%0Aimport org.junit.jupiter.api.BeforeEach;%0Aimport org.junit.jupiter.api.Test;%0Aimport org.mockito.internal.util.collections.Sets;%0Aimport org.springframework.beans.factory.BeanFactory;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.test.context.SpringBootTest;%0Aimport org.springframework.test.annotation.DirtiesContext;%0Aimport org.springframework.test.annotation.DirtiesContext.ClassMode;%0Aimport org.springframework.test.context.ActiveProfiles;%0Aimport org.springframework.test.context.web.WebAppConfiguration;%0A%0A@SpringBootTest%0A@ActiveProfiles(%7B%22desktop%22, %22test%22%7D)%0A@WebAppConfiguration%0A@DirtiesContext(classMode = ClassMode.AFTER_CLASS)%0Aclass CSVExporterTest %7B%0A%0A  @Autowired%0A  private BeanFactory beanFactory;%0A%0A  @Autowired%0A  private CSVExporter exporter;%0A  private AnnisUI ui;%0A%0A%0A  @BeforeEach%0A  void setup() %7B%0A    UIScopeImpl.setBeanStoreRetrievalStrategy(new SingletonBeanStoreRetrievalStrategy());%0A    this.ui = beanFactory.getBean(AnnisUI.class);%0A    MockVaadin.setup(() -%3E ui);%0A  %7D%0A%0A  @Test%0A  void exportFeigenblattQuery() throws IOException %7B%0A    EventBus eventBus = mock(EventBus.class);%0A    Writer out = new StringWriter();%0A    %0A    Exception ex = exporter.convertText(%22tok=%5C%22Feigenblatt%5C%22%22, QueryLanguage.AQL, 5, 5,%0A        Sets.newSet(%22pcc2%22), null,%0A        %22%22, false, out, eventBus, new HashMap%3C%3E(), ui);%0A%0A    assertNull(ex);%0A%0A    // Compare the generated CSV file with the ground truth%0A    out.close();%0A    String%5B%5D lines = out.toString().split(%22%5Cn%22);%0A    assertEquals(3, lines.length);%0A    assertEquals(%221_id%5Ct1_span%5Ct1_anno_tiger::lemma%5Ct1_anno_tiger::morph%5Ct1_anno_tiger::pos%22,%0A        lines%5B0%5D);%0A    assertEquals(%22salt:/pcc2/11299#tok_1%5CtFeigenblatt%5CtFeigenblatt%5CtNom.Sg.Neut%5CtNN%22, lines%5B1%5D);%0A    assertEquals(%22salt:/pcc2/11299#tok_143%5CtFeigenblatt%5CtFeigenblatt%5CtDat.Sg.Neut%5CtNN%22, lines%5B2%5D);%0A  %7D%0A%0A%7D%0A

Add more specific test for CSV exporter