本文整理了Java中org.junit.jupiter.api.Nested.<init>()
方法的一些代码示例,展示了Nested.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Nested.<init>()
方法的具体详情如下:
包路径:org.junit.jupiter.api.Nested
类名称:Nested
方法名:<init>
暂无
代码示例来源:origin: spring-projects/spring-framework
@Nested
class CatTests extends GenericComicCharactersTests<Cat> {
@Override
int getExpectedNumCharacters() {
return 2;
}
@Override
String getExpectedName() {
return "Catbert";
}
}
代码示例来源:origin: spring-projects/spring-framework
@Nested
class DogTests extends GenericComicCharactersTests<Dog> {
@Override
int getExpectedNumCharacters() {
return 1;
}
@Override
String getExpectedName() {
return "Dogbert";
}
}
代码示例来源:origin: testcontainers/testcontainers-java
@Nested
class NestedTestCase {
@Test
void top_level_containers_should_be_running() {
assertTrue(TOP_LEVEL_CONTAINER.isRunning());
}
@Test
void ids_should_not_change() {
assertEquals(topLevelContainerId, TOP_LEVEL_CONTAINER.getContainerId());
}
}
}
代码示例来源:origin: neo4j/neo4j
@Nested
class NestedRandomTest
{
@Inject
RandomRule nestedRandom;
@Test
@RandomRule.Seed( 15 )
void randomSeedSetupTest()
{
assertEquals( 15, nestedRandom.seed() );
}
@Test
void randomExtensionIgnoreAssumptionFailure()
{
assumeTrue( false );
}
}
}
代码示例来源:origin: neo4j/neo4j
@Nested
class NestedFileSystemTest
{
@Inject
DefaultFileSystemAbstraction nestedFileSystem;
@Test
void nestedFileSystemInjection()
{
assertNotNull( nestedFileSystem );
}
@Test
void rootFileSystemAvailable()
{
assertNotNull( rootFileSystem );
}
@Test
void nestedAndRootFileSystemsAreTheSame()
{
assertSame( nestedFileSystem, rootFileSystem );
}
}
}
代码示例来源:origin: neo4j/neo4j
@Nested
class NestedFileSystemTest
{
@Inject
EphemeralFileSystemAbstraction nestedFileSystem;
@Test
void nestedFileSystemInjection()
{
assertNotNull( nestedFileSystem );
}
@Test
void rootFileSystemAvailable()
{
assertNotNull( rootFileSystem );
}
@Test
void nestedAndRootFileSystemsAreTheSame()
{
assertSame( nestedFileSystem, rootFileSystem );
}
}
}
代码示例来源:origin: cloudfoundry/uaa
@Nested
class WhenPhoneNumberIsNull {
@BeforeEach
void nullSomeFieldsOfUserInDb() {
scimUserFromDB.setPhoneNumbers(null);
}
@Test
void shouldNotBeAllowed() {
assertUpdateIsNotAllowed();
}
}
代码示例来源:origin: cloudfoundry/uaa
@Nested
class WhenUpdatingThePhoneNumbersFieldToBecomeNull {
@BeforeEach
void setup() {
scimUserFromRequest.setPhoneNumbers(null);
setRequestContent();
}
@Test
void isNotAllowedToUpdateField() {
assertUpdateIsNotAllowed();
}
}
代码示例来源:origin: cloudfoundry/uaa
@Nested
class WhenUpdatingTheSaltField {
@BeforeEach
void setup() {
scimUserFromRequest.setSalt(null);
setRequestContent();
}
@Test
void isNotAllowedToUpdateField() {
assertUpdateIsNotAllowed();
}
}
代码示例来源:origin: cloudfoundry/uaa
@Nested
class WhenSettingTheFieldsToBeTheSameAsItAlreadyWas {
@BeforeEach
void setup() {
setRequestContent();
}
@Test
void isAllowedToUpdateFieldBecauseItIsNotReallyAnUpdate() {
assertUpdateIsAllowed();
}
}
代码示例来源:origin: spring-projects/spring-framework
@Nested
@SpringJUnitConfig(NestedConfig.class)
class AutowiredConstructorParameterTests {
final String bar;
AutowiredConstructorParameterTests(@Autowired String bar) {
this.bar = bar;
}
@Test
void nestedTest() throws Exception {
assertEquals("foo", foo);
assertEquals("bar", bar);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Nested
@SpringJUnitConfig(NestedConfig.class)
class QualifiedConstructorParameterTests {
final String bar;
QualifiedConstructorParameterTests(TestInfo testInfo, @Qualifier("bar") String s) {
this.bar = s;
}
@Test
void nestedTest() throws Exception {
assertEquals("foo", foo);
assertEquals("bar", bar);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Nested
@SpringJUnitConfig(NestedConfig.class)
class NestedTests {
@Autowired
String bar;
@Test
void nestedTest() throws Exception {
// In contrast to nested test classes running in JUnit 4, the foo
// field in the outer instance should have been injected from the
// test ApplicationContext for the outer instance.
assertEquals("foo", foo);
assertEquals("bar", bar);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Nested
@SpringJUnitConfig(NestedConfig.class)
class AutowiredConstructorTests {
final String bar;
@Autowired
AutowiredConstructorTests(String bar) {
this.bar = bar;
}
@Test
void nestedTest() throws Exception {
assertEquals("foo", foo);
assertEquals("bar", bar);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Nested
@SpringJUnitConfig(NestedConfig.class)
class SpelConstructorParameterTests {
final String bar;
final int answer;
SpelConstructorParameterTests(@Autowired String bar, TestInfo testInfo, @Value("#{ 6 * 7 }") int answer) {
this.bar = bar;
this.answer = answer;
}
@Test
void nestedTest() throws Exception {
assertEquals("foo", foo);
assertEquals("bar", bar);
assertEquals(42, answer);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Nested
@SpringJUnitConfig(PopulatedSchemaDatabaseConfig.class)
@Transactional
class NestedTests {
@Autowired
JdbcTemplate jdbcTemplate;
@BeforeTransaction
@AfterTransaction
void checkInitialDatabaseState() {
assertEquals(0, countRowsInTable("user"));
}
@Test
@Sql("/org/springframework/test/context/jdbc/data.sql")
void nestedSqlScripts() {
assertEquals(1, countRowsInTable("user"));
}
private int countRowsInTable(String tableName) {
return JdbcTestUtils.countRowsInTable(this.jdbcTemplate, tableName);
}
}
代码示例来源:origin: gocd/gocd
@Nested
@DisplayName("When web app has started")
class WhenWebAppHasStarted {
@BeforeEach
void setUp() {
webAppHasStarted();
}
@Test
void shouldRedirectSlashOrRootToLandingPage() throws Exception {
landingPageIsSetTo("/landingpage");
MockResponse response = request("/", "*/*");
assertTrue(response.wasRedirectedTo("/go/landingpage").done());
}
}
代码示例来源:origin: spring-projects/spring-framework
@SpringJUnitConfig(Config.class)
@Nested
@DisabledIf("true")
class DisabledIfOnClassTests {
@Test
void foo() {
fail("This test must be disabled");
}
@Test
@DisabledIf("false")
void bar() {
fail("This test must be disabled due to class-level condition");
}
}
代码示例来源:origin: spring-projects/spring-framework
@SpringJUnitConfig(Config.class)
@Nested
@EnabledIf("false")
class EnabledIfOnClassTests {
@Test
void foo() {
fail("This test must be disabled");
}
@Test
@EnabledIf("true")
void bar() {
fail("This test must be disabled due to class-level condition");
}
}
代码示例来源:origin: cloudfoundry/uaa
@Nested
@DefaultTestContext
@TestPropertySource(properties = "assetBaseUrl=//cdn.example.com/resources")
class DefaultLogo {
@Test
void testDefaultLogo(@Autowired MockMvc mockMvc) throws Exception {
mockMvc.perform(get("/login"))
.andExpect(content().string(containsString("url(//cdn.example.com/resources/images/product-logo.png)")));
}
}
内容来源于网络,如有侵权,请联系作者删除!