CreatePortGroupTaskTest.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:osc-core 作者:
@Test
public void testExecute_WhenDomainIsNotFound_ThrowsException() throws Exception {
    // Arrange.
    SecurityGroup sg = registerSecurityGroup(1L, "projectId", "projectName", 1L, "sgName");
    sg.addSecurityGroupMember(newSGMWithPort(1L));

    ostRegisterPorts(sg);

    // domain id null
    registerDomain(null, sg);

    this.exception.expect(Exception.class);
    this.exception
    .expectMessage(String.format("A domain was not found for the project: '%s' and Security Group: '%s",
            sg.getProjectName(), sg.getName()));

    CreatePortGroupTask task = this.factoryTask.create(sg);

    // Act.
    task.execute();

    // Assert.
    verify(this.em, Mockito.never()).merge(any());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号