I need to break this method into two methods as we are allowed only 20 executable statements in a method.
Can you please help?


private EC2Environment commonSteps() {
        final Work work = Mockito.mock(Work.class);
        final Wallet wallet = Mockito.mock(Wallet.class);
        final EC2Client client = Mockito.mock(EC2Client.class);
        final AmazonEC2 aws = Mockito.mock(AmazonEC2.class);
        final DescribeInstancesResult instanceresult =
            Mockito.mock(DescribeInstancesResult.class);
        final List<Reservation> reservations =
            (List<Reservation>) Mockito.mock(List.class);
        final Reservation reservation = Mockito.mock(Reservation.class);
        final List<Instance> instances =
            (List<Instance>) Mockito.mock(List.class);
        final Instance instance = Mockito.mock(Instance.class);
        final Placement placement = Mockito.mock(Placement.class);
        final InstanceState instanceState = Mockito.mock(InstanceState.class);
        final TerminateInstancesResult result =
            Mockito.mock(TerminateInstancesResult.class);
        final InstanceStateChange stateChange =
            Mockito.mock(InstanceStateChange.class);
        final List<InstanceStateChange> stateChanges =
            (List<InstanceStateChange>) Mockito.mock(List.class);
        Mockito.when(client.get()).thenReturn(aws);
        Mockito
            .when(
                aws.describeInstances(
                    Matchers.any(DescribeInstancesRequest.class)
            )
        ).thenReturn(instanceresult);
        Mockito.when(
            instanceresult.getReservations()
        ).thenReturn(reservations);
        Mockito.when(reservations.get(0)).thenReturn(reservation);
        Mockito.when(reservation.getInstances()).thenReturn(instances);
        Mockito.when(instances.isEmpty()).thenReturn(false);
        Mockito.when(instances.get(0)).thenReturn(instance);
        Mockito.when(instance.getPlacement()).thenReturn(placement);
        Mockito.when(instance.getState()).thenReturn(instanceState);
        Mockito.when(instanceState.getName()).thenReturn("running");
        Mockito.when(
            aws.terminateInstances(
                Matchers.any(TerminateInstancesRequest.class)
            )
        ).thenReturn(result);
        Mockito.when(result.getTerminatingInstances()).thenReturn(stateChanges);
        Mockito.when(stateChanges.get(0)).thenReturn(stateChange);
        Mockito.when(instance.getLaunchTime()).thenReturn(new Date());
        Mockito.when(instance.getInstanceType()).thenReturn("InstanceType");
        Mockito.when(placement.getAvailabilityZone()).thenReturn("ZONE");
        final EC2Environment eC2Environment =
            new EC2Environment(work, wallet, "instance", client);
        return eC2Environment;
    }