当前位置: 首页>>代码示例>>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;未经允许,请勿转载。