org.junit.jupiter.api.Tag类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中org.junit.jupiter.api.Tag类的一些代码示例,展示了Tag类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tag类的具体详情如下:
包路径:org.junit.jupiter.api.Tag
类名称:Tag

Tag介绍

暂无

代码示例

代码示例来源:origin: cloudfoundry/uaa

@Tag("oidc spec")
@Tag("uaa oidc logic")
@Nested
@DisplayName("when the user doesn't request the 'openid' scope")
@WithSpring
class WhenUserDoesntRequestOpenIdScope {
  @BeforeEach
  void setupRequest() {
    requestedScope = "uaa.admin";
  }
  @DisplayName("id token should not be returned")
  @ParameterizedTest
  @ValueSource(strings = {GRANT_TYPE_PASSWORD, GRANT_TYPE_AUTHORIZATION_CODE, GRANT_TYPE_IMPLICIT})
  public void ensureAnIdTokenIsNotReturned(String grantType) {
    AuthorizationRequest authorizationRequest = constructAuthorizationRequest(clientId, grantType, requestedScope);
    OAuth2Authentication auth2Authentication = constructUserAuthenticationFromAuthzRequest(authorizationRequest, "admin", "uaa");
    CompositeToken accessToken = (CompositeToken) tokenServices.createAccessToken(auth2Authentication);
    assertAll("id token is not returned, and a useful log message is printed",
     () -> assertThat(accessToken.getIdTokenValue(), is(nullValue())),
     () -> assertThat("Useful log message", loggingOutputStream.toString(), containsString("an ID token was requested but 'openid' is missing from the requested scopes"))
    );
  }
}

代码示例来源:origin: cloudfoundry/uaa

@Tag("https://tools.ietf.org/html/rfc7519#section-5.3")
@Test
void shouldNotAllowAnyReplicatedHeaders(@RandomValue String randomVal) {
  objectNode.put(randomVal, randomVal);
  Assertions.assertThrows(Exception.class, () ->
      JwtHeaderHelper.create(asBase64(objectNode.toString()))
  );
}

代码示例来源:origin: cloudfoundry/uaa

@Tag("https://tools.ietf.org/html/rfc7516#section-4.1.2")
@DisplayName("the enc/iv header claims are for JWE tokens.")
@Test
void shouldSerializeOnlyWithValidRequiredHeaders() {
  final CommonSigner hmac = new CommonSigner("fake-key", "HMAC", null);
  JwtHeader header = JwtHeaderHelper.create(hmac.algorithm(), hmac.keyId(), hmac.keyURL());
  assertThat(header.toString(), not(containsString("enc")));
  assertThat(header.toString(), not(containsString("iv")));
  assertThat(header.toString(), not(containsString("jwk")));
  assertThat(header.toString(), not(containsString("x5u")));
  assertThat(header.toString(), not(containsString("x5c")));
  assertThat(header.toString(), not(containsString("x5t")));
  assertThat(header.toString(), not(containsString("x5t#S256")));
  assertThat(header.toString(), not(containsString("crit")));
  // support not including `cty` if not present for back-compat
  assertThat(header.toString(), not(containsString("cty")));
}

代码示例来源:origin: cloudfoundry/uaa

@Tag("oidc spec")
@Tag("uaa oidc logic")
@DisplayName("ensureIdToken Returned when Client Has OpenId Scope and Scope=OpenId withGrantType")
@ParameterizedTest
@ValueSource(strings = {GRANT_TYPE_PASSWORD, GRANT_TYPE_AUTHORIZATION_CODE, GRANT_TYPE_IMPLICIT})
public void ensureIdTokenReturned_withGrantType(String grantType) {
  AuthorizationRequest authorizationRequest = constructAuthorizationRequest(clientId, grantType, requestedScope);
  OAuth2Authentication auth2Authentication = constructUserAuthenticationFromAuthzRequest(authorizationRequest, "admin", "uaa");
  CompositeToken accessToken = (CompositeToken) tokenServices.createAccessToken(auth2Authentication);
  assertThat(accessToken.getIdTokenValue(), is(not(nullValue())));
  JwtHelper.decode(accessToken.getIdTokenValue());
}

代码示例来源:origin: cloudfoundry/uaa

@Tag("https://tools.ietf.org/html/rfc7519#ref-JWS")
@DisplayName("JWS")
@Nested

代码示例来源:origin: cloudfoundry/uaa

@Tag("https://tools.ietf.org/html/rfc7519#section-5")
@DisplayName("JOSE Header")
@ExtendWith(RandomParametersJunitExtension.class)

代码示例来源:origin: cloudfoundry/uaa

@Tag("oidc spec")
@DisplayName("id token should contain jku header")
@Test
public void ensureJKUHeaderIsSetWhenBuildingAnIdToken() {
  AuthorizationRequest authorizationRequest = constructAuthorizationRequest(clientId, GRANT_TYPE_PASSWORD, requestedScope);
  OAuth2Authentication auth2Authentication = constructUserAuthenticationFromAuthzRequest(authorizationRequest, "admin", "uaa");
  CompositeToken accessToken = (CompositeToken) tokenServices.createAccessToken(auth2Authentication);
  Jwt jwtToken = JwtHelper.decode(accessToken.getIdTokenValue());
  assertThat(jwtToken.getHeader().getJku(), startsWith(uaaUrl));
  assertThat(jwtToken.getHeader().getJku(), is("https://uaa.some.test.domain.com:555/uaa/token_keys"));
}

代码示例来源:origin: junit-team/junit5-samples

@Tag("fast")
class FirstTest {

  @Test
  @DisplayName("My 1st JUnit 5 test! 😎")
  void myFirstTest(TestInfo testInfo) {
    Calculator calculator = new Calculator();
    assertEquals(2, calculator.add(1, 1), "1 + 1 should equal 2");
    assertEquals("My 1st JUnit 5 test! 😎", testInfo.getDisplayName(), () -> "TestInfo is injected correctly");
  }

}

代码示例来源:origin: bonigarcia/mastering-junit5

@Tag("functional")
class FunctionalTest {

  @Test
  void testOne() {
    System.out.println("Functional Test 1");
  }

  @Test
  void testTwo() {
    System.out.println("Functional Test 2");
  }

}

代码示例来源:origin: kolorobot/unit-testing-demo

@Tag("fast")
class FirstTest { // not a public class

  @Test
  @DisplayName("My 1st JUnit 5 test! 😎")
  void myFirstTest(TestInfo testInfo) {
    BiFunction<Integer, Integer, Integer> adder = (number, number2) -> number + number2;

    assertEquals(Integer.valueOf(2), adder.apply(1, 1), "1 + 1 should equal 2");
    assertEquals("My 1st JUnit 5 test! 😎", testInfo.getDisplayName(), () -> "TestInfo is injected correctly");
  }

}

代码示例来源:origin: bonigarcia/mastering-junit5

@Tag("timed")
@ExtendWith(TimingExtension.class)
public interface TimeExecutionLogger {
}

代码示例来源:origin: bonigarcia/mastering-junit5

@Tag("timed")
@ExtendWith(TimingExtension.class)
public interface TimeExecutionLogger {
}

代码示例来源:origin: org.flowable/flowable-engine

/**
 * Base class for the flowable test cases.
 *
 * The main reason not to use our own test support classes is that we need to run our test suite with various configurations, e.g. with and without spring, standalone or on a server etc. Those
 * requirements create some complications so we think it's best to use a separate base class. That way it is much easier for us to maintain our own codebase and at the same time provide stability on
 * the test support classes that we offer as part of our api (in org.flowable.engine.test).
 *
 * @author Tom Baeyens
 * @author Joram Barrez
 */
@Tag("pluggable")
@ExtendWith(PluggableFlowableExtension.class)
public abstract class PluggableFlowableTestCase extends AbstractFlowableTestCase {

}

代码示例来源:origin: twitch4j/twitch4j

@Slf4j
@Tag("integration")
public class ChannelServiceTest extends AbstractKrakenServiceTest {

  @Test
  @DisplayName("getSubscribers")
  @Disabled // test acc has no subs
  public void getSubscribers() {
    KrakenSubscriptionList resultList = getTwitchKrakenClient().getChannelSubscribers(AbstractKrakenServiceTest.getCredential().getAccessToken(), 149223493l, null, null, null).execute();

    assertTrue(resultList.getSubscriptions().size() > 0, "Didn't find any subscriptions!");
  }

}

代码示例来源:origin: twitch4j/twitch4j

@Slf4j
@Tag("integration")
public class IngestsServiceTest extends AbstractKrakenServiceTest {

  @Test
  @DisplayName("getIngestServerList")
  @Disabled
  public void getIngestServerList() {
    KrakenIngestList resultList = getTwitchKrakenClient().getIngestServers().execute();

    assertTrue(resultList.getIngests().size() > 0, "Didn't find any ingest servers!");
  }

}

代码示例来源:origin: twitch4j/twitch4j

@Slf4j
@Tag("integration")
public class BitsServiceTest extends AbtractEndpointTest {

  /**
   * Get Bits Leaderboard
   */
  @Test
  @DisplayName("Fetch the bits leaderboard")
  public void getBitsLeaderboard() {
    // TestCase
    BitsLeaderboard resultList = testUtils.getTwitchHelixClient().getBitsLeaderboard(testUtils.getCredential().getAccessToken(), "10", "all", null, null).execute();

    // Test
    assertTrue(resultList.getEntries().size() == 0, "That account can't get bits, so it's always a empty list");
  }

}

代码示例来源:origin: bonigarcia/mastering-junit5

@Test
@Tag("performance")
@Tag("load")
void testOne() {
  System.out.println("Non-Functional Test 1 (Performance/Load)");
}

代码示例来源:origin: bonigarcia/mastering-junit5

@Test
@Tag("performance")
@Tag("stress")
void testTwo() {
  System.out.println("Non-Functional Test 2 (Performance/Stress)");
}

代码示例来源:origin: junit-team/junit5-samples

@Test
  @Tag("slow")
  void aSlowTest() throws InterruptedException {
    Thread.sleep(1000);
  }
}

代码示例来源:origin: howtoprogram/junit5-examples

@Test
  @Tag("fast")
  public void validateOrder() {
  }
}

相关文章