ActualRequirements getRequirements(
     RuntimeAnnotatedExecutionTrace runtimeAnnotatedExecutionTrace) {
   @Nullable
   Requirements requirements = runtimeAnnotatedExecutionTrace.getAnnotation(Requirements.class);
   return requirements == null
       ? defaultRequirements
       : new ActualRequirements(requirements.cpuCores(), requirements.memoryGB());
 }
  @Test
  public void getRequirementsNull() {
    RequirementsProvider requirementsProvider = new RequirementsProvider(3, 4);

    RuntimeAnnotatedExecutionTrace executionTrace =
        Mockito.mock(RuntimeAnnotatedExecutionTrace.class);
    when(executionTrace.getAnnotation(Requirements.class)).thenReturn(null);

    Assert.assertEquals(
        requirementsProvider.getRequirements(executionTrace), new ActualRequirements(3, 4));
  }
  @Test
  public void getRequirementsNonNull() {
    RequirementsProvider requirementsProvider = new RequirementsProvider(3, 4);

    Requirements requirements = Mockito.mock(Requirements.class);
    when(requirements.cpuCores()).thenReturn(5);
    when(requirements.memoryGB()).thenReturn(6);

    RuntimeAnnotatedExecutionTrace executionTrace =
        Mockito.mock(RuntimeAnnotatedExecutionTrace.class);
    when(executionTrace.getAnnotation(Requirements.class)).thenReturn(requirements);

    Assert.assertEquals(
        requirementsProvider.getRequirements(executionTrace), new ActualRequirements(5, 6));
  }