<commit_before>package com.tfl.api.test;

import com.frameworkium.core.api.tests.BaseTest;
import com.tfl.api.dto.carparkoccupancy.CarParkOccupancies;
import com.tfl.api.dto.carparkoccupancy.CarParkOccupancy;
import com.tfl.api.service.carparks.CarParkOccupancyService;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import static com.google.common.truth.Truth.assertThat;

@Test
public class CarParksTest extends BaseTest {

    private CarParkOccupancies carParkOccupancies;

    /**
     * Make the service call only once using {@link BeforeClass} to speed up
     * tests while allowing fine grain tests.
     */
    @BeforeClass
    public void setUp() {
        carParkOccupancies = new CarParkOccupancyService().getCarParkOccupancies();
        pacing(1);
    }


    public void all_car_park_occupancies_more_than_10_spaces() {

        assertThat(carParkOccupancies.getTotalNumFree())
                .isGreaterThan(10);
    }

    public void all_car_park_occupancies_contains_ruislip() {

        assertThat(carParkOccupancies.getNames())
                .contains("R<NAME> (LUL)");
    }

    public void single_car_park_request_information_the_same() {
        // N.B. this test might fail if the number of free/used bays changes
        // between the first and subsequent service call
        // this is due to using a live service and not controlling test data

        CarParkOccupancy randomCPO = carParkOccupancies.getRandom();

        // Get said CPO via ID
        CarParkOccupancy specificCPO =
                new CarParkOccupancyService()
                        .getCarParkOccupancyByID(randomCPO.id);

        // Make sure they are the same ignoring the details of the bays
        assertThat(specificCPO.equalsIgnoringBays(randomCPO)).isTrue();
    }

    public void single_car_park_has_sane_number_of_free_spaces() {

        String randomCPOID = carParkOccupancies.getRandom().id;

        // Get said CP via ID
        int freeSpaces = new CarParkOccupancyService()
                .getCarParkOccupancyByID(randomCPOID)
                .getNumFreeSpaces();

        // Make sure things are sane
        assertThat(freeSpaces).isAtLeast(0);
        assertThat(freeSpaces).isLessThan(10000);
    }

    @Test(enabled = false) // possible bug in the service
    public void free_and_occupied_equals_total() {

        assertThat(carParkOccupancies.getTotalNumSpaces())
                .isEqualTo(carParkOccupancies.getTotalNumFreeAndOccupied());
    }

    /***
     * This method is used to overcome 429 status code (too many requests) thrown
     * when testing the webservice.
     * @param seconds
     */
    private void pacing(long seconds) {
        try {
            Thread.sleep(seconds * 1000L);
        } catch (InterruptedException ie) {
            ie.printStackTrace();
        }
    }

}<commit_msg>Remove pacing and enabled previous failing test.<commit_after>package com.tfl.api.test;

import com.frameworkium.core.api.tests.BaseTest;
import com.tfl.api.dto.carparkoccupancy.CarParkOccupancies;
import com.tfl.api.dto.carparkoccupancy.CarParkOccupancy;
import com.tfl.api.service.carparks.CarParkOccupancyService;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import static com.google.common.truth.Truth.assertThat;

@Test
public class CarParksTest extends BaseTest {

    private CarParkOccupancies carParkOccupancies;

    /**
     * Make the service call only once using {@link BeforeClass} to speed up
     * tests while allowing fine grain tests.
     */
    @BeforeClass
    public void setUp() {
        carParkOccupancies = new CarParkOccupancyService().getCarParkOccupancies();
    }

    public void all_car_park_occupancies_more_than_10_spaces() {

        assertThat(carParkOccupancies.getTotalNumFree())
                .isGreaterThan(10);
    }

    public void all_car_park_occupancies_contains_ruislip() {

        assertThat(carParkOccupancies.getNames())
                .contains("<NAME> (LUL)");
    }

    public void single_car_park_request_information_the_same() {
        // N.B. this test might fail if the number of free/used bays changes
        // between the first and subsequent service call
        // this is due to using a live service and not controlling test data

        CarParkOccupancy randomCPO = carParkOccupancies.getRandom();

        // Get said CPO via ID
        CarParkOccupancy specificCPO =
                new CarParkOccupancyService()
                        .getCarParkOccupancyByID(randomCPO.id);

        // Make sure they are the same ignoring the details of the bays
        assertThat(specificCPO.equalsIgnoringBays(randomCPO)).isTrue();
    }

    public void single_car_park_has_sane_number_of_free_spaces() {

        String randomCPOID = carParkOccupancies.getRandom().id;

        // Get said CP via ID
        int freeSpaces = new CarParkOccupancyService()
                .getCarParkOccupancyByID(randomCPOID)
                .getNumFreeSpaces();

        // Make sure things are sane
        assertThat(freeSpaces).isAtLeast(0);
        assertThat(freeSpaces).isLessThan(10000);
    }

    @Test
    public void free_and_occupied_equals_total() {

        assertThat(carParkOccupancies.getTotalNumSpaces())
                .isEqualTo(carParkOccupancies.getTotalNumFreeAndOccupied());
    }

}
{'fraction_non_alphanumeric': 0.08061813442561906, 'fraction_numerical': 0.005213181902811394, 'mean_word_length': 2.8591954022988504, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7052283', 'n_tokens_mistral': 1660, 'n_tokens_neox': 1548, 'n_words': 349}