Search in sources :

Example 1 with Document

use of org.jdom2.Document in project k-9 by k9mail.

the class SettingsExporterTest method exportPreferences_setsFormatTo1.

@Test
public void exportPreferences_setsFormatTo1() throws Exception {
    Document document = exportPreferences(false, Collections.<String>emptySet());
    assertEquals("1", document.getRootElement().getAttributeValue("format"));
}
Also used : Document(org.jdom2.Document) Test(org.junit.Test)

Example 2 with Document

use of org.jdom2.Document in project k-9 by k9mail.

the class SettingsExporterTest method exportPreferences_setsVersionToLatest.

@Test
public void exportPreferences_setsVersionToLatest() throws Exception {
    Document document = exportPreferences(false, Collections.<String>emptySet());
    assertEquals(Integer.toString(Settings.VERSION), document.getRootElement().getAttributeValue("version"));
}
Also used : Document(org.jdom2.Document) Test(org.junit.Test)

Example 3 with Document

use of org.jdom2.Document in project k-9 by k9mail.

the class SettingsExporterTest method exportPreferences_ignoresGlobalSettingsWhenRequested.

@Test
public void exportPreferences_ignoresGlobalSettingsWhenRequested() throws Exception {
    Document document = exportPreferences(false, Collections.<String>emptySet());
    assertNull(document.getRootElement().getChild("global"));
}
Also used : Document(org.jdom2.Document) Test(org.junit.Test)

Example 4 with Document

use of org.jdom2.Document in project gocd by gocd.

the class DirectoryEntriesTest method shouldReturnAMessageWhenThereAreNoArtifacts.

@Test
public void shouldReturnAMessageWhenThereAreNoArtifacts() throws Exception {
    HtmlRenderer renderer = new HtmlRenderer("context");
    DirectoryEntries directoryEntries = new DirectoryEntries();
    directoryEntries.add(new FolderDirectoryEntry("cruise-output", "", new DirectoryEntries()));
    directoryEntries.setIsArtifactsDeleted(true);
    directoryEntries.render(renderer);
    Element document = getRenderedDocument(renderer);
    assertThat(document.getChildren().size(), is(2));
    assertThat(document.getChild("p").getTextNormalize(), Matchers.containsString("Artifacts for this job instance are unavailable as they may have been or deleted externally. Re-run the stage or job to generate them again."));
    assertThat(document.getChild("ul").getChild("div").getChild("span").getChild("a").getTextNormalize(), is("cruise-output"));
}
Also used : Element(org.jdom2.Element) HtmlRenderer(com.thoughtworks.go.server.presentation.models.HtmlRenderer) Test(org.junit.Test)

Example 5 with Document

use of org.jdom2.Document in project gocd by gocd.

the class DirectoryEntriesTest method shouldReturnAMessageWhenAllArtifactsHaveBeenDeletedButArtifactsDeletedFlagHasNotBeenSet.

@Test
public void shouldReturnAMessageWhenAllArtifactsHaveBeenDeletedButArtifactsDeletedFlagHasNotBeenSet() throws Exception {
    HtmlRenderer renderer = new HtmlRenderer("context");
    DirectoryEntries directoryEntries = new DirectoryEntries();
    directoryEntries.render(renderer);
    Element document = getRenderedDocument(renderer);
    assertThat(document.getChildren().size(), is(1));
    assertThat(document.getChild("p").getTextNormalize(), Matchers.containsString("Artifacts for this job instance are unavailable as they may have been or deleted externally. Re-run the stage or job to generate them again."));
}
Also used : Element(org.jdom2.Element) HtmlRenderer(com.thoughtworks.go.server.presentation.models.HtmlRenderer) Test(org.junit.Test)

Aggregations

Document (org.jdom2.Document)86 Element (org.jdom2.Element)76 Test (org.junit.Test)33 File (java.io.File)29 DocType (org.jdom2.DocType)24 SAXBuilder (org.jdom2.input.SAXBuilder)21 IOException (java.io.IOException)16 XMLOutputter (org.jdom2.output.XMLOutputter)15 ProcessingInstruction (org.jdom2.ProcessingInstruction)13 XmlFile (jmri.jmrit.XmlFile)11 Document (com.google.cloud.language.v1beta2.Document)10 ApiException (com.google.api.gax.grpc.ApiException)9 Document (com.google.cloud.language.v1.Document)9 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)9 StatusRuntimeException (io.grpc.StatusRuntimeException)9 ArrayList (java.util.ArrayList)9 EncodingType (com.google.cloud.language.v1beta2.EncodingType)8 FileOutputStream (java.io.FileOutputStream)8 JLabel (javax.swing.JLabel)7 EncodingType (com.google.cloud.language.v1.EncodingType)6