### Question:
ChildEnvironmentService { public boolean isChildEnvironment(String environmentCrn, String accountId) { return repository.findParentStackByChildEnvironmentCrn(environmentCrn, accountId).isPresent(); }  boolean isChildEnvironment(String environmentCrn, String accountId); Optional<Stack> findParentByEnvironmentCrnAndAccountId(String environmentCrn, String accountId); List<ChildEnvironment> findChildEnvironments(Stack stack, String accountId); void attachChildEnvironment(AttachChildEnvironmentRequest request, String accountId); void detachChildEnvironment(DetachChildEnvironmentRequest request, String accountId);  }### Answer:
@Test void isChildEnvironmentFalse() { when(repository.findParentStackByChildEnvironmentCrn(ENVIRONMENT_CRN, ACCOUNT_ID)).thenReturn(Optional.empty()); boolean result = underTest.isChildEnvironment(ENVIRONMENT_CRN, ACCOUNT_ID); assertFalse(result); }
@Test void isChildEnvironmentTrue() { when(repository.findParentStackByChildEnvironmentCrn(ENVIRONMENT_CRN, ACCOUNT_ID)).thenReturn(Optional.of(new Stack())); boolean result = underTest.isChildEnvironment(ENVIRONMENT_CRN, ACCOUNT_ID); assertTrue(result); }