assertThat(resource.getResourceName()).doesNotContain("com/google/common/reflect/");
@Test public void undirectedGraph() { graph = ValueGraphBuilder.undirected().allowsSelfLoops(true).build(); graph.putEdgeValue(1, 2, "valueA"); graph.putEdgeValue(2, 1, "valueB"); // overwrites valueA in undirected case graph.putEdgeValue(2, 3, "valueC"); graph.putEdgeValue(4, 4, "valueD"); assertThat(graph.edgeValueOrDefault(1, 2, null)).isEqualTo("valueB"); assertThat(graph.edgeValueOrDefault(2, 1, null)).isEqualTo("valueB"); assertThat(graph.edgeValueOrDefault(2, 3, null)).isEqualTo("valueC"); assertThat(graph.edgeValueOrDefault(4, 4, null)).isEqualTo("valueD"); assertThat(graph.edgeValueOrDefault(1, 2, DEFAULT)).isEqualTo("valueB"); assertThat(graph.edgeValueOrDefault(2, 1, DEFAULT)).isEqualTo("valueB"); assertThat(graph.edgeValueOrDefault(2, 3, DEFAULT)).isEqualTo("valueC"); assertThat(graph.edgeValueOrDefault(4, 4, DEFAULT)).isEqualTo("valueD"); String toString = graph.toString(); assertThat(toString).doesNotContain("valueA"); assertThat(toString).contains("valueB"); assertThat(toString).contains("valueC"); assertThat(toString).contains("valueD"); }
@Test public void shouldPutTheMessageIntoTheView() { String message = "This is only a test"; shadow.callOnCreate(null); View dialogView = shadow.getView(); assertThat(shadowOf(dialogView).innerText()).doesNotContain(message); dialog.setMessage(message); assertThat(shadowOf(shadow.getView()).innerText()).contains(message); }
assertThat(logFormatter.format(record)).doesNotContain("NoOpService");
@Test public void testTokenForLogging() throws Exception { OAuth2Token token = new OAuth2Token("secret", "type", "secret", 100, "Test"); assertThat(token.getTokenForLogging()).doesNotContain("secret"); assertThat(token.toString()).doesNotContain("secret"); } }
@Test public void keystoreProvidedDoesNotPrintWarning() throws Exception { ByteArrayOutputStream output = new ByteArrayOutputStream(); BuildApksCommand.fromFlags( new FlagParser() .parse( "--bundle=" + bundlePath, "--output=" + outputFilePath, "--aapt2=" + AAPT2_PATH, "--ks=" + keystorePath, "--ks-key-alias=" + KEY_ALIAS, "--ks-pass=pass:" + KEYSTORE_PASSWORD, "--key-pass=pass:" + KEY_PASSWORD), new PrintStream(output), systemEnvironmentProvider, fakeAdbServer); assertThat(new String(output.toByteArray(), UTF_8)) .doesNotContain("WARNING: The APKs won't be signed"); }
@Test public void testAddLine_typesWithSameName() { String code = source() .addLine("package com.example;") .addLine("// This should be explicit: %s", java.util.List.class) .addLine("// This should be explicit: %s", java.awt.List.class) .toString(); assertThat(code).doesNotContain("import java.util.List;\n"); assertThat(code).doesNotContain("import java.awt.List;\n"); assertThat(code).contains("// This should be explicit: java.util.List\n"); assertThat(code).contains("// This should be explicit: java.awt.List\n"); }
@Test public void mergeHeaders() throws Exception { File output = new File(".test-files/mergeHeaders/merged-manifest.yml"); File zip = new File(".test-files/mergeHeaders/headers.zip"); zip.getParentFile().mkdirs(); Files.write("xyz", zip, StandardCharsets.UTF_8); output.delete(); String text = main("merge", "headers", "com.github.jomof:sqlite:3.16.2-rev48", zip.toString(), "include", output.toString()); assertThat(text).doesNotContain("Usage"); assertThat(text).contains("Merged com.github.jomof:sqlite:3.16.2-rev48 and "); System.out.printf(text); System.out.printf(FileUtils.readAllText(output)); }
@Test public void linksForFailedRequests_InSummaryTable() { OutputStream output = new ByteArrayOutputStream(); TracezZPageHandler tracezZPageHandler = TracezZPageHandler.create(runningSpanStore, sampledSpanStore); when(runningSpanStore.getSummary()).thenReturn(runningSpanStoreSummary); when(sampledSpanStore.getSummary()).thenReturn(sampledSpanStoreSummary); tracezZPageHandler.emitHtml(Collections.emptyMap(), output); // No sampled links (ztype=1); assertThat(output.toString()).doesNotContain("href=\"?zspanname=TestActiveSpan&ztype=2"); // Links for 7 errors 2 CANCELLED + 5 DEADLINE_EXCEEDED; assertThat(output.toString()) .contains("href='?zspanname=TestSampledSpan&ztype=2&zsubtype=0'>7"); // Links for 7 errors 2 CANCELLED + 5 DEADLINE_EXCEEDED; assertThat(output.toString()) .contains("href='?zspanname=TestActiveAndSampledSpan&ztype=2&zsubtype=0'>7"); }
@Test public void managedSdk_feature_enabled_settingsNotVisible() { when(mockPluginInfoService.shouldEnable(GctFeature.MANAGED_SDK)).thenReturn(true); AppEngineCloudConfigurable appEngineCloudConfigurable = new AppEngineCloudConfigurable(); assertThat(getAppEngineMoreInfoLabelText(appEngineCloudConfigurable)) .doesNotContain("Go to Google -> Cloud SDK settings"); }
@Test public void linksForActiveRequests_InSummaryTable() { OutputStream output = new ByteArrayOutputStream(); TracezZPageHandler tracezZPageHandler = TracezZPageHandler.create(runningSpanStore, sampledSpanStore); when(runningSpanStore.getSummary()).thenReturn(runningSpanStoreSummary); when(sampledSpanStore.getSummary()).thenReturn(sampledSpanStoreSummary); tracezZPageHandler.emitHtml(Collections.emptyMap(), output); // 3 active requests assertThat(output.toString()).contains("href='?zspanname=TestActiveSpan&ztype=0&zsubtype=0'>3"); // No active links assertThat(output.toString()) .doesNotContain("href='?zspanname=TestSampledSpan&ztype=0&zsubtype=0'"); // 5 active requests assertThat(output.toString()) .contains("href='?zspanname=TestActiveAndSampledSpan&ztype=0&zsubtype=0'>5"); }
@Test public void download() throws Exception { CDepYml config = new CDepYml(); File yaml = new File(".test-files/download/cdep.yml"); yaml.getParentFile().mkdirs(); Files.write("builders: [cmake, cmakeExamples]\n" + "dependencies:\n" + "- compile: com.github.jomof:low-level-statistics:0.0.16\n", yaml, StandardCharsets.UTF_8); // Download first. main("-wf", yaml.getParent()); // Redownload String result = main("download", "-wf", yaml.getParent()); System.out.printf(result); assertThat(result).doesNotContain("Redownload"); assertThat(result).contains("Generating"); }
@Test public void alternateDownloadFoldersRelativePath2() throws Exception { CDepYml config = new CDepYml(); File yaml = new File(".test-files/alternateDownloadFolders2/cdep.yml"); yaml.getParentFile().mkdirs(); Files.write("builders: [cmake, cmakeExamples]\n" + "downloadedPackagesFolder: ./my-downloaded-packages\n" + "generatedModulesFolder: ./my-modules\n" + "dependencies:\n" + "- compile: com.github.jomof:low-level-statistics:0.0.16\n", yaml, StandardCharsets.UTF_8); // Download first. main("-wf", yaml.getParent()); // Redownload String result = main("download", "-wf", yaml.getParent()); System.out.printf(result); assertThat(new File(yaml.getParent(), "my-downloaded-packages").isDirectory()).isTrue(); assertThat(new File(yaml.getParent(), "my-modules").isDirectory()).isTrue(); assertThat(result).doesNotContain("Redownload"); assertThat(result).contains("Generating"); }
@Test public void alternateDownloadFoldersRelativePath1() throws Exception { CDepYml config = new CDepYml(); File yaml = new File(".test-files/alternateDownloadFolders1/cdep.yml"); yaml.getParentFile().mkdirs(); Files.write("builders: [cmake, cmakeExamples]\n" + "downloadedPackagesFolder: my-downloaded-packages\n" + "generatedModulesFolder: my-modules\n" + "dependencies:\n" + "- compile: com.github.jomof:low-level-statistics:0.0.16\n", yaml, StandardCharsets.UTF_8); // Download first. main("-wf", yaml.getParent()); // Redownload String result = main("download", "-wf", yaml.getParent()); System.out.printf(result); assertThat(new File(yaml.getParent(), "my-downloaded-packages").isDirectory()).isTrue(); assertThat(new File(yaml.getParent(), "my-modules").isDirectory()).isTrue(); assertThat(result).doesNotContain("Redownload"); assertThat(result).contains("Generating"); }
@Test public void alternateDownloadFoldersAbsolutePath() throws Exception { CDepYml config = new CDepYml(); File yaml = new File(".test-files/alternateDownloadFolders1/cdep.yml"); File downloadFolder = new File(yaml.getParent(), "my-downloaded-packages"); File modulesFolder = new File(yaml.getParent(), "my-modules"); yaml.getParentFile().mkdirs(); String text = "builders: [cmake, cmakeExamples]\n" + "downloadedPackagesFolder: {DOWNLOAD}\n" + "generatedModulesFolder: {GENERATED}\n" + "dependencies:\n" + "- compile: com.github.jomof:low-level-statistics:0.0.16\n"; text = text.replace("{DOWNLOAD}", downloadFolder.getCanonicalPath()); text = text.replace("{GENERATED}", modulesFolder.getCanonicalPath()); Files.write(text, yaml, StandardCharsets.UTF_8); // Download first. main("-wf", yaml.getParent()); // Redownload String result = main("download", "-wf", yaml.getParent()); System.out.printf(result); assertThat(downloadFolder.isDirectory()).isTrue(); assertThat(modulesFolder.isDirectory()).isTrue(); assertThat(result).doesNotContain("Redownload"); assertThat(result).contains("Generating"); }
@Test public void checkArchiveSentinel() throws Exception { File yaml = new File(".test-files/checkArchiveSentinel/cdep.yml"); File downloadFolder = new File(yaml.getParent(), "my-downloaded-packages"); File modulesFolder = new File(yaml.getParent(), "my-modules"); yaml.getParentFile().mkdirs(); String text = "builders: [cmake, cmakeExamples]\n" + "downloadedPackagesFolder: {DOWNLOAD}\n" + "generatedModulesFolder: {GENERATED}\n" + "dependencies:\n" + "- compile: com.github.jomof:low-level-statistics:0.0.16\n"; text = text.replace("{DOWNLOAD}", downloadFolder.getCanonicalPath()); text = text.replace("{GENERATED}", modulesFolder.getCanonicalPath()); Files.write(text, yaml, StandardCharsets.UTF_8); // Download first. main("-wf", yaml.getParent()); // Redownload String result = main("download", "-wf", yaml.getParent()); System.out.printf(result); assertThat(downloadFolder.isDirectory()).isTrue(); assertThat(modulesFolder.isDirectory()).isTrue(); assertThat(result).doesNotContain("Redownload"); assertThat(result).contains("Generating"); // Check that the sentinel file was created File sentinel = new File(downloadFolder, "exploded/com.github.jomof/low-level-statistics/0.0.16/low-level-statistics-android-platform-21.zip/cdep-archive.yml"); assertThat(sentinel.isFile()).isTrue(); }
@Test public void alternateDownloadFoldersRelativePath3() throws Exception { CDepYml config = new CDepYml(); File yaml = new File(".test-files/alternateDownloadFolders3/cdep.yml"); yaml.getParentFile().mkdirs(); Files.write("builders: [cmake, cmakeExamples]\n" + "downloadedPackagesFolder: ./my-downloaded-packages/nested\n" + "generatedModulesFolder: ./my-modules/nested\n" + "dependencies:\n" + "- compile: com.github.jomof:low-level-statistics:0.0.16\n", yaml, StandardCharsets.UTF_8); // Download first. main("-wf", yaml.getParent()); // Redownload String result = main("download", "-wf", yaml.getParent()); System.out.printf(result); assertThat(new File(yaml.getParent(), "my-downloaded-packages/nested").isDirectory()).isTrue(); assertThat(new File(yaml.getParent(), "my-modules/nested").isDirectory()).isTrue(); assertThat(result).doesNotContain("Redownload"); assertThat(result).contains("Generating"); }
@Test public void linksForSampledRequests_InSummaryTable() { OutputStream output = new ByteArrayOutputStream(); TracezZPageHandler tracezZPageHandler = TracezZPageHandler.create(runningSpanStore, sampledSpanStore); when(runningSpanStore.getSummary()).thenReturn(runningSpanStoreSummary); when(sampledSpanStore.getSummary()).thenReturn(sampledSpanStoreSummary); tracezZPageHandler.emitHtml(Collections.emptyMap(), output); // No sampled links (ztype=1); assertThat(output.toString()).doesNotContain("href=\"?zspanname=TestActiveSpan&ztype=1"); // Links for 7 samples [10us, 100us) and 3 samples [1ms, 10ms); assertThat(output.toString()) .contains("href='?zspanname=TestSampledSpan&ztype=1&zsubtype=1'>7"); assertThat(output.toString()) .contains("href='?zspanname=TestSampledSpan&ztype=1&zsubtype=3'>3"); // Links for 7 samples [10us, 100us) and 3 samples [1ms, 10ms); assertThat(output.toString()) .contains("href='?zspanname=TestActiveAndSampledSpan&ztype=1&zsubtype=1'>7"); assertThat(output.toString()) .contains("href='?zspanname=TestActiveAndSampledSpan&ztype=1&zsubtype=3'>3"); }
@Test public void undirectedGraph() { graph = ValueGraphBuilder.undirected().allowsSelfLoops(true).build(); graph.putEdgeValue(1, 2, "valueA"); graph.putEdgeValue(2, 1, "valueB"); // overwrites valueA in undirected case graph.putEdgeValue(2, 3, "valueC"); graph.putEdgeValue(4, 4, "valueD"); assertThat(graph.edgeValueOrDefault(1, 2, null)).isEqualTo("valueB"); assertThat(graph.edgeValueOrDefault(2, 1, null)).isEqualTo("valueB"); assertThat(graph.edgeValueOrDefault(2, 3, null)).isEqualTo("valueC"); assertThat(graph.edgeValueOrDefault(4, 4, null)).isEqualTo("valueD"); assertThat(graph.edgeValueOrDefault(1, 2, DEFAULT)).isEqualTo("valueB"); assertThat(graph.edgeValueOrDefault(2, 1, DEFAULT)).isEqualTo("valueB"); assertThat(graph.edgeValueOrDefault(2, 3, DEFAULT)).isEqualTo("valueC"); assertThat(graph.edgeValueOrDefault(4, 4, DEFAULT)).isEqualTo("valueD"); String toString = graph.toString(); assertThat(toString).doesNotContain("valueA"); assertThat(toString).contains("valueB"); assertThat(toString).contains("valueC"); assertThat(toString).contains("valueD"); }
assertThat(logFormatter.format(record)).doesNotContain("NoOpService");