コード例 #1
0
  @Test(expected = CloudbreakException.class)
  public void getOrchestratorWhenNotExist() throws CloudbreakException {
    ReflectionTestUtils.setField(underTest, "containerOrchestratorName", "test3");
    Map<String, ContainerOrchestrator> map = new HashMap<>();
    TestOneMockContainerOrchestrator testOneMockContainerOrchestrator =
        new TestOneMockContainerOrchestrator();
    map.put(testOneMockContainerOrchestrator.name(), testOneMockContainerOrchestrator);
    TestTwoMockContainerOrchestrator testTwoMockContainerOrchestrator =
        new TestTwoMockContainerOrchestrator();
    map.put(testTwoMockContainerOrchestrator.name(), testTwoMockContainerOrchestrator);
    ReflectionTestUtils.setField(underTest, "containerOrchestrators", map);

    underTest.get();
  }
コード例 #2
0
  @Test
  public void getOrchestratorWhenExist() throws CloudbreakException {
    ReflectionTestUtils.setField(underTest, "containerOrchestratorName", "test1");
    Map<String, ContainerOrchestrator> map = new HashMap<>();
    TestOneMockContainerOrchestrator testOneMockContainerOrchestrator =
        new TestOneMockContainerOrchestrator();
    map.put(testOneMockContainerOrchestrator.name(), testOneMockContainerOrchestrator);
    TestTwoMockContainerOrchestrator testTwoMockContainerOrchestrator =
        new TestTwoMockContainerOrchestrator();
    map.put(testTwoMockContainerOrchestrator.name(), testTwoMockContainerOrchestrator);
    ReflectionTestUtils.setField(underTest, "containerOrchestrators", map);

    ContainerOrchestrator containerOrchestrator = underTest.get();
    assertNotNull(containerOrchestrator);
  }