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

x33g5p2x  于2022-01-24 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(133)

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

Nested介绍

暂无

代码示例

代码示例来源: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: cloudfoundry/uaa

@Nested
class WhenDisplayNameIsNull {
  @BeforeEach
  void nullSomeFieldsOfUserInDb() {
    scimUserFromDB.setDisplayName(null);
  }
  @Test
  void shouldNotBeAllowed() {
    assertUpdateIsNotAllowed();
  }
}

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

@Nested
  class WhenPhoneNumberIsAnEmptyList {
    @BeforeEach
    void nullSomeFieldsOfUserInDb() {
      scimUserFromDB.setPhoneNumbers(Lists.newArrayList());
    }
    @Test
    void shouldNotBeAllowed() {
      assertUpdateIsNotAllowed();
    }
  }
}

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

@Nested
  class WhenNameIsNull {
    @BeforeEach
    void nullSomeFieldsOfUserInDb() {
      scimUserFromDB.setName(null);
    }
    @Test
    void shouldBeAllowed() {
      assertUpdateIsAllowed();
    }
  }
}

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

@Nested
class WhenUpdatingTheExternalIdField {
  @BeforeEach
  void setup() {
    scimUserFromRequest.setExternalId(null);
    setRequestContent();
  }
  @Test
  void isNotAllowedToUpdateField() {
    assertUpdateIsNotAllowed();
  }
}

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

@Nested
class WhenExternalIdIsNull {
  @BeforeEach
  void nullSomeFieldsOfUserInDb() {
    scimUserFromDB.setExternalId(null);
  }
  @Test
  void shouldNotBeAllowed() {
    assertUpdateIsNotAllowed();
  }
}

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

@Nested
class WhenUpdatingTheUsernameField {
  @BeforeEach
  void setup() {
    scimUserFromRequest.setUserName(null);
    setRequestContent();
  }
  @Test
  void isNotAllowedToUpdateField() {
    assertUpdateIsNotAllowed();
  }
}

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

@Nested
class WhenUpdatingTheActiveField {
  @BeforeEach
  void setup() {
    scimUserFromRequest.setActive(true);
    setRequestContent();
  }
  @Test
  void isNotAllowedToUpdateField() {
    assertUpdateIsNotAllowed();
  }
}

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

@Nested
class WhenSaltIsNull {
  @BeforeEach
  void nullSomeFieldsOfUserInDb() {
    scimUserFromDB.setSalt(null);
  }
  @Test
  void shouldNotBeAllowed() {
    assertUpdateIsNotAllowed();
  }
}

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

@Nested
class WhenUpdatingTheEmailFieldToAddASecondEmail {
  @BeforeEach
  void setup() {
    scimUserFromRequest.addEmail("abc");
    setRequestContent();
  }
  @Test
  void isAllowedToUpdateField() {
    assertUpdateIsAllowed();
  }
}

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

@Nested
class WhenUpdatingTheDisplayNameField {
  @BeforeEach
  void setup() {
    scimUserFromRequest.setDisplayName(null);
    setRequestContent();
  }
  @Test
  void isNotAllowedToUpdateField() {
    assertUpdateIsNotAllowed();
  }
}

相关文章

Nested类方法