@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(); }
@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); }