use of de.micromata.opengis.kml.v_2_2_0.Document in project k-9 by k9mail.
the class SettingsExporterTest method exportPreferences_exportsGlobalSettingsWhenRequested.
@Test
public void exportPreferences_exportsGlobalSettingsWhenRequested() throws Exception {
Document document = exportPreferences(true, Collections.<String>emptySet());
assertNotNull(document.getRootElement().getChild("global"));
}
use of de.micromata.opengis.kml.v_2_2_0.Document in project k-9 by k9mail.
the class SettingsExporterTest method exportPreferences_producesXML.
@Test
public void exportPreferences_producesXML() throws Exception {
Document document = exportPreferences(false, Collections.<String>emptySet());
assertEquals("k9settings", document.getRootElement().getName());
}
use of de.micromata.opengis.kml.v_2_2_0.Document in project k-9 by k9mail.
the class SettingsExporterTest method exportPreferences.
private Document exportPreferences(boolean globalSettings, Set<String> accounts) throws Exception {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
SettingsExporter.exportPreferences(RuntimeEnvironment.application, outputStream, globalSettings, accounts);
Document document = parseXML(outputStream.toByteArray());
outputStream.close();
return document;
}
use of de.micromata.opengis.kml.v_2_2_0.Document in project google-cloud-java by GoogleCloudPlatform.
the class AnalyzeSentiment method main.
public static void main(String... args) throws Exception {
// Instantiates a client
LanguageServiceClient language = LanguageServiceClient.create();
// The text to analyze
String[] texts = { "I love this!", "I hate this!" };
for (String text : texts) {
Document doc = Document.newBuilder().setContent(text).setType(Type.PLAIN_TEXT).build();
// Detects the sentiment of the text
Sentiment sentiment = language.analyzeSentiment(doc).getDocumentSentiment();
System.out.printf("Text: \"%s\"%n", text);
System.out.printf("Sentiment: score = %s, magnitude = %s%n", sentiment.getScore(), sentiment.getMagnitude());
}
}
use of de.micromata.opengis.kml.v_2_2_0.Document in project google-cloud-java by GoogleCloudPlatform.
the class LanguageServiceClientTest method analyzeEntitySentimentTest.
@Test
@SuppressWarnings("all")
public void analyzeEntitySentimentTest() {
String language = "language-1613589672";
AnalyzeEntitySentimentResponse expectedResponse = AnalyzeEntitySentimentResponse.newBuilder().setLanguage(language).build();
mockLanguageService.addResponse(expectedResponse);
Document document = Document.newBuilder().build();
EncodingType encodingType = EncodingType.NONE;
AnalyzeEntitySentimentResponse actualResponse = client.analyzeEntitySentiment(document, encodingType);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockLanguageService.getRequests();
Assert.assertEquals(1, actualRequests.size());
AnalyzeEntitySentimentRequest actualRequest = (AnalyzeEntitySentimentRequest) actualRequests.get(0);
Assert.assertEquals(document, actualRequest.getDocument());
Assert.assertEquals(encodingType, actualRequest.getEncodingType());
}
Aggregations