當前位置: 首頁>>代碼示例>>Java>>正文


Java Assume.assumeFalse方法代碼示例

本文整理匯總了Java中org.junit.Assume.assumeFalse方法的典型用法代碼示例。如果您正苦於以下問題:Java Assume.assumeFalse方法的具體用法?Java Assume.assumeFalse怎麽用?Java Assume.assumeFalse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.junit.Assume的用法示例。


在下文中一共展示了Assume.assumeFalse方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testVerifyIdTokenWithExplicitProjectId

import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testVerifyIdTokenWithExplicitProjectId() throws Exception {
  GoogleCredentials credentials = TestOnlyImplFirebaseTrampolines.getCredentials(firebaseOptions);
  Assume.assumeFalse(
      "Skipping testVerifyIdTokenWithExplicitProjectId for service account credentials",
      credentials instanceof ServiceAccountCredentials);

  FirebaseOptions options =
      new FirebaseOptions.Builder(firebaseOptions)
          .setProjectId("mock-project-id")
          .build();
  FirebaseApp app = FirebaseApp.initializeApp(options, "testVerifyIdTokenWithExplicitProjectId");
  try {
    FirebaseAuth.getInstance(app).verifyIdTokenAsync("foo").get();
    fail("Expected exception.");
  } catch (ExecutionException expected) {
    Assert.assertNotEquals(
        "com.google.firebase.FirebaseException: Must initialize FirebaseApp with a project ID "
            + "to call verifyIdToken()",
        expected.getMessage());
    assertTrue(expected.getCause() instanceof IllegalArgumentException);
  }
}
 
開發者ID:firebase,項目名稱:firebase-admin-java,代碼行數:24,代碼來源:FirebaseAuthTest.java

示例2: testServiceAccountRequired

import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testServiceAccountRequired() throws Exception {
  GoogleCredentials credentials = TestOnlyImplFirebaseTrampolines.getCredentials(firebaseOptions);
  Assume.assumeFalse("Skipping testServiceAccountRequired for service account credentials",
      credentials instanceof ServiceAccountCredentials);

  FirebaseApp app = FirebaseApp.initializeApp(firebaseOptions, "testServiceAccountRequired");
  try {
    FirebaseAuth.getInstance(app).createCustomTokenAsync("foo").get();
    fail("Expected exception.");
  } catch (IllegalStateException expected) {
    Assert.assertEquals(
        "Must initialize FirebaseApp with a service account credential to call "
            + "createCustomToken()",
        expected.getMessage());
  }
}
 
開發者ID:firebase,項目名稱:firebase-admin-java,代碼行數:18,代碼來源:FirebaseAuthTest.java

示例3: runDebugTest

import org.junit.Assume; //導入方法依賴的package包/類
private void runDebugTest(LanguageFeatures languageFeatures, String debuggeeClass,
    List<JUnit3Wrapper.Command> commands) throws Throwable {
  // Skip test due to unsupported runtime.
  Assume.assumeTrue("Skipping test " + testName.getMethodName() + " because ART is not supported",
      ToolHelper.artSupported());
  Assume.assumeFalse(
      "Skipping failing test " + testName.getMethodName() + " for runtime " + ToolHelper
          .getDexVm(), UNSUPPORTED_ART_VERSIONS.contains(ToolHelper.getDexVm()));

  String[] paths;
  if (RUNTIME_KIND == RuntimeKind.JAVA) {
    paths = new String[] { JDWP_JAR.toString(), languageFeatures.getJarPath().toString() };
  } else {
    paths = new String[] { jdwpDexD8.toString(), languageFeatures.getDexPath().toString() };
  }
  new JUnit3Wrapper(debuggeeClass, paths, commands).runBare();
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:18,代碼來源:DebugTestBase.java

示例4: testNullResponse

import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testNullResponse() throws Exception {
	// GIVEN
	// mapping of null responses to JSON-API disabled
	Assume.assumeFalse(enableNullResponse);

	// WHEN
	Response response = get("/repositoryActionWithNullResponse", null);

	// THEN
	Assert.assertNotNull(response);
	assertThat(response.getStatus())
			.describedAs("Status code")
			.isEqualTo(Response.Status.NO_CONTENT.getStatusCode());
	MediaType mediaType = response.getMediaType();
	assertThat(mediaType)
			.describedAs("Media-Type")
			.isEqualTo(null);
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:20,代碼來源:JsonApiResponseFilterTestBase.java

示例5: testNonInterfaceMethodWithNullResponseJsonApi

import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testNonInterfaceMethodWithNullResponseJsonApi() throws Exception {
	// GIVEN
	// mapping of null responses to JSON-API disabled
	Assume.assumeFalse(enableNullResponse);

	// WHEN
	Response response = get("/nonInterfaceMethodWithNullResponseJsonApi", null);

	// THEN
	Assert.assertNotNull(response);
	assertThat(response.getStatus())
			.describedAs("Status code")
			.isEqualTo(Response.Status.NO_CONTENT.getStatusCode());
	MediaType mediaType = response.getMediaType();
	assertThat(mediaType)
			.describedAs("Media-Type")
			.isEqualTo(null);
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:20,代碼來源:JsonApiResponseFilterTestBase.java

示例6: init

import org.junit.Assume; //導入方法依賴的package包/類
@BeforeClass
public static void init() throws Exception {
  enableDefaultUser(false);
  Assume.assumeFalse(BaseTestServer.isMultinode());
  try (Timer.TimedBlock b = Timer.time("[email protected]")) {
    dacConfig = dacConfig.writePath(folder1.newFolder().getAbsolutePath());
    startDaemon();
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:10,代碼來源:TestResetPassword.java

示例7: testCustomSslImplementation

import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testCustomSslImplementation() throws Exception {

    TesterSupport.configureClientSsl();

    Tomcat tomcat = getTomcatInstance();
    Connector connector = tomcat.getConnector();

    Assume.assumeFalse("This test is only for JSSE based SSL connectors",
            connector.getProtocolHandlerClassName().contains("Apr"));

    connector.setProperty("sslImplementationName",
            "org.apache.tomcat.util.net.jsse.TesterBug50640SslImpl");
    connector.setProperty(TesterBug50640SslImpl.PROPERTY_NAME,
            TesterBug50640SslImpl.PROPERTY_VALUE);

    connector.setProperty("sslProtocol", "tls");

    File keystoreFile =
        new File("test/org/apache/tomcat/util/net/localhost.jks");
    connector.setAttribute(
            "keystoreFile", keystoreFile.getAbsolutePath());

    connector.setSecure(true);
    connector.setProperty("SSLEnabled", "true");

    File appDir = new File(getBuildDirectory(), "webapps/examples");
    tomcat.addWebapp(null, "/examples", appDir.getAbsolutePath());

    tomcat.start();
    ByteChunk res = getUrl("https://localhost:" + getPort() +
        "/examples/servlets/servlet/HelloWorldExample");
    assertTrue(res.toString().indexOf("<a href=\"../helloworld.html\">") > 0);
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:35,代碼來源:TestCustomSsl.java

示例8: testManyConnections

import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testManyConnections() {
    Assume.assumeFalse(RedissonRuntimeEnvironment.isTravis);
    Config redisConfig = new Config();
    redisConfig.useSingleServer()
    .setConnectionMinimumIdleSize(10000)
    .setConnectionPoolSize(10000)
    .setAddress(RedisRunner.getDefaultRedisServerBindAddressAndPort());
    RedissonClient r = Redisson.create(redisConfig);
    r.shutdown();
}
 
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:12,代碼來源:RedissonTest.java

示例9: testInvalidProtocolVersion

import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testInvalidProtocolVersion() throws Exception {
    // This test sends fake bytes upon connection and can't work properly in SSL context.
    Assume.assumeFalse(context().ssl().isPresent());

    InetSocketAddress addr = newServerAddress();

    NetworkServer server = createAndConfigureServer(cfg ->
        cfg.setDisableHeartbeats(true)
    );

    server.start(addr, new NetworkServerCallbackMock()).get();

    repeat(3, i -> {
        try (
            Socket socket = new Socket(addr.getAddress(), addr.getPort());
            OutputStream out = socket.getOutputStream();
            InputStream in = socket.getInputStream()
        ) {
            // Valid magic bytes
            out.write((byte)(Utils.MAGIC_BYTES >> 24));
            out.write((byte)(Utils.MAGIC_BYTES >> 16));
            out.write((byte)(Utils.MAGIC_BYTES >> 8));
            out.write((byte)Utils.MAGIC_BYTES);

            // Invalid version.
            out.write(new byte[]{1, 2, 3, 4, 5, 6, 7});
            out.flush();

            assertEquals(-1, in.read());
        }
    });
}
 
開發者ID:hekate-io,項目名稱:hekate,代碼行數:34,代碼來源:NetworkServerTest.java

示例10: skipWindowsOs

import org.junit.Assume; //導入方法依賴的package包/類
@BeforeClass
public static void skipWindowsOs() {
    Assume.assumeFalse(OperationSystemHelper.isWindows());
}
 
開發者ID:amvnetworks,項目名稱:amv-access-api-poc,代碼行數:5,代碼來源:EmbeddedMySqlApplicationIT.java

示例11: setUp

import org.junit.Assume; //導入方法依賴的package包/類
@Before
public void setUp() {
    // Ignore on SPARC
    Assume.assumeFalse("skipping on AArch64", getTarget().arch instanceof AArch64);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:AheadOfTimeCompilationTest.java

示例12: should_report_as_skipped

import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void should_report_as_skipped(){
    Assume.assumeFalse(true);
}
 
開發者ID:arquillian,項目名稱:arquillian-reporter,代碼行數:5,代碼來源:GreeterTest.java

示例13: doTestWriteTimeoutServer

import org.junit.Assume; //導入方法依賴的package包/類
private void doTestWriteTimeoutServer(boolean setTimeoutOnContainer)
        throws Exception {

    // This will never work for BIO
    Assume.assumeFalse(
            "Skipping test. This feature will never work for BIO connector.",
            getProtocol().equals(Http11Protocol.class.getName()));

    /*
     * Note: There are all sorts of horrible uses of statics in this test
     *       because the API uses classes and the tests really need access
     *       to the instances which simply isn't possible.
     */
    timeoutOnContainer = setTimeoutOnContainer;

    Tomcat tomcat = getTomcatInstance();

    // No file system docBase required
    Context ctx = tomcat.addContext("", null);
    ctx.addApplicationListener(ConstantTxConfig.class.getName());
    Tomcat.addServlet(ctx, "default", new DefaultServlet());
    ctx.addServletMapping("/", "default");

    WebSocketContainer wsContainer =
            ContainerProvider.getWebSocketContainer();

    tomcat.start();

    Session wsSession = wsContainer.connectToServer(
            TesterProgrammaticEndpoint.class,
            ClientEndpointConfig.Builder.create().build(),
            new URI("ws://" + getHostName() + ":" + getPort() +
                    ConstantTxConfig.PATH));

    wsSession.addMessageHandler(new BlockingBinaryHandler());

    int loops = 0;
    while (loops < 15) {
        Thread.sleep(1000);
        if (!ConstantTxEndpoint.getRunning()) {
            break;
        }
        loops++;
    }

    // Close the client session, primarily to allow the
    // BackgroundProcessManager to shut down.
    wsSession.close();

    // Check the right exception was thrown
    Assert.assertNotNull(ConstantTxEndpoint.getException());
    Assert.assertEquals(ExecutionException.class,
            ConstantTxEndpoint.getException().getClass());
    Assert.assertNotNull(ConstantTxEndpoint.getException().getCause());
    Assert.assertEquals(SocketTimeoutException.class,
            ConstantTxEndpoint.getException().getCause().getClass());

    // Check correct time passed
    Assert.assertTrue(ConstantTxEndpoint.getTimeout() >= TIMEOUT_MS);

    // Check the timeout wasn't too long
    Assert.assertTrue(ConstantTxEndpoint.getTimeout() < TIMEOUT_MS*2);
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:64,代碼來源:TestWsWebSocketContainer.java

示例14: runGitHubJsonBlockTest

import org.junit.Assume; //導入方法依賴的package包/類
public static void runGitHubJsonBlockTest(String json, Set<String> excluded) throws ParseException, IOException {
    Assume.assumeFalse("Online test is not available", json.equals(""));

    BlockTestSuite testSuite = new BlockTestSuite(json);
    Set<String> testCases = testSuite.getTestCases().keySet();
    Map<String, Boolean> summary = new HashMap<>();

    for (String testCase : testCases)
        if ( excluded.contains(testCase))
            logger.info(" [X] " + testCase);
        else
            logger.info("     " + testCase);


    for (String testName : testCases) {

        if ( excluded.contains(testName)) {
            logger.info(" Not running: " + testName);
            continue;
        }

        List<String> result = runSingleBlockTest(testSuite, testName);

        if (!result.isEmpty())
            summary.put(testName, false);
        else
            summary.put(testName, true);
    }


    logger.info("");
    logger.info("");
    logger.info("Summary: ");
    logger.info("=========");

    int fails = 0; int pass = 0;
    for (String key : summary.keySet()){

        if (summary.get(key)) ++pass; else ++fails;
        String sumTest = String.format("%-60s:^%s", key, (summary.get(key) ? "OK" : "FAIL")).
                replace(' ', '.').
                replace("^", " ");
        logger.info(sumTest);
    }

    logger.info(" - Total: Pass: {}, Failed: {} - ", pass, fails);

    Assert.assertTrue(fails == 0);

}
 
開發者ID:rsksmart,項目名稱:rskj,代碼行數:51,代碼來源:GitHubJSONTestSuite.java

示例15: testBug56032

import org.junit.Assume; //導入方法依賴的package包/類
@Test
public void testBug56032() throws Exception {
    // TODO Investigate options to get this test to pass with the HTTP BIO
    //      connector.
    Assume.assumeFalse(
            "Skip this test on BIO. TODO: investigate options to make it pass with HTTP BIO connector",
            getTomcatInstance().getConnector().getProtocolHandlerClassName().equals(
                    "org.apache.coyote.http11.Http11Protocol"));

    Tomcat tomcat = getTomcatInstance();
    // No file system docBase required
    Context ctx = tomcat.addContext("", null);
    ctx.addApplicationListener(TesterFirehoseServer.Config.class.getName());
    Tomcat.addServlet(ctx, "default", new DefaultServlet());
    ctx.addServletMapping("/", "default");

    TesterSupport.initSsl(tomcat);

    tomcat.start();

    WebSocketContainer wsContainer =
            ContainerProvider.getWebSocketContainer();
    ClientEndpointConfig clientEndpointConfig =
            ClientEndpointConfig.Builder.create().build();
    clientEndpointConfig.getUserProperties().put(
            WsWebSocketContainer.SSL_TRUSTSTORE_PROPERTY,
            "test/org/apache/tomcat/util/net/ca.jks");
    Session wsSession = wsContainer.connectToServer(
            TesterProgrammaticEndpoint.class,
            clientEndpointConfig,
            new URI("wss://localhost:" + getPort() +
                    TesterFirehoseServer.Config.PATH));

    // Process incoming messages very slowly
    MessageHandler handler = new SleepingText(5000);
    wsSession.addMessageHandler(handler);
    wsSession.getBasicRemote().sendText("Hello");

    // Wait long enough for the buffers to fill and the send to timeout
    int count = 0;
    int limit = TesterFirehoseServer.WAIT_TIME_MILLIS / 100;

    System.err.println("Waiting for server to report an error");
    while (TesterFirehoseServer.Endpoint.getErrorCount() == 0 && count < limit) {
        Thread.sleep(100);
        count ++;
    }

    if (TesterFirehoseServer.Endpoint.getErrorCount() == 0) {
        Assert.fail("No error reported by Endpoint when timeout was expected");
    }

    // Wait up to another 20 seconds for the connection to be closed
    System.err.println("Waiting for connection to be closed");
    count = 0;
    limit = (TesterFirehoseServer.SEND_TIME_OUT_MILLIS * 4) / 100;
    while (TesterFirehoseServer.Endpoint.getOpenConnectionCount() != 0 && count < limit) {
        Thread.sleep(100);
        count ++;
    }

    int openConnectionCount = TesterFirehoseServer.Endpoint.getOpenConnectionCount();
    if (openConnectionCount != 0) {
        Assert.fail("There are [" + openConnectionCount + "] connections still open");
    }

    // Close the client session.
    wsSession.close();
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:70,代碼來源:TestWebSocketFrameClientSSL.java


注:本文中的org.junit.Assume.assumeFalse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。