<commit_before>/*
 * Copyright 2016 BlackWholeLabs.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package tech.blackhole.blacknectar.service.api;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import tech.blackhole.blacknectar.service.stores.Location;
import tech.sirwellington.alchemy.generator.NumberGenerators;
import tech.sirwellington.alchemy.test.junit.runners.AlchemyTestRunner;
import tech.sirwellington.alchemy.test.junit.runners.DontRepeat;
import tech.sirwellington.alchemy.test.junit.runners.GeneratePojo;
import tech.sirwellington.alchemy.test.junit.runners.Repeat;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import static tech.blackhole.blacknectar.service.BlackNectarGenerators.locations;
import static tech.sirwellington.alchemy.generator.AlchemyGenerator.one;
import static tech.sirwellington.alchemy.generator.NumberGenerators.doubles;
import static tech.sirwellington.alchemy.generator.NumberGenerators.integers;
import static tech.sirwellington.alchemy.generator.NumberGenerators.negativeIntegers;
import static tech.sirwellington.alchemy.generator.StringGenerators.alphabeticString;
import static tech.sirwellington.alchemy.test.junit.ThrowableAssertion.assertThrows;

/**
 *
 * @author SirWellington
 */
@Repeat(50)
@RunWith(AlchemyTestRunner.class)
public class BlackNectarSearchRequestTest
{

    @GeneratePojo
    private BlackNectarSearchRequest generated;

    private BlackNectarSearchRequest instance;

    private Location center;
    private double radiusInMeters;
    private int limit;
    private String searchTerm;

    @Before
    public void setUp() throws Exception
    {
        setupData();

        instance = new BlackNectarSearchRequest();
    }

    private void setupData() throws Exception
    {
        center = one(locations());
        limit = one(integers(0, 1_000));
        radiusInMeters = one(doubles(0, 10_000));
        searchTerm = one(alphabeticString());

    }

    @Test
    public void testHasRadius()
    {
        assertThat(instance.hasRadius(), is(false));

        instance.radiusInMeters = radiusInMeters;

        if (radiusInMeters > 0)<commit_msg>Updates BlackNectarSearchRequestTest to use positive numbers in tests<commit_after>/*
 * Copyright 2016 BlackWholeLabs.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package tech.blackhole.blacknectar.service.api;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import tech.blackhole.blacknectar.service.stores.Location;
import tech.sirwellington.alchemy.generator.NumberGenerators;
import tech.sirwellington.alchemy.test.junit.runners.AlchemyTestRunner;
import tech.sirwellington.alchemy.test.junit.runners.DontRepeat;
import tech.sirwellington.alchemy.test.junit.runners.GeneratePojo;
import tech.sirwellington.alchemy.test.junit.runners.Repeat;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import static tech.blackhole.blacknectar.service.BlackNectarGenerators.locations;
import static tech.sirwellington.alchemy.generator.AlchemyGenerator.one;
import static tech.sirwellington.alchemy.generator.NumberGenerators.negativeIntegers;
import static tech.sirwellington.alchemy.generator.NumberGenerators.positiveDoubles;
import static tech.sirwellington.alchemy.generator.NumberGenerators.positiveIntegers;
import static tech.sirwellington.alchemy.generator.StringGenerators.alphabeticString;
import static tech.sirwellington.alchemy.test.junit.ThrowableAssertion.assertThrows;

/**
 *
 * @author SirWellington
 */
@Repeat(50)
@RunWith(AlchemyTestRunner.class)
public class BlackNectarSearchRequestTest
{

    @GeneratePojo
    private BlackNectarSearchRequest generated;

    private BlackNectarSearchRequest instance;

    private Location center;
    private double radiusInMeters;
    private int limit;
    private String searchTerm;

    @Before
    public void setUp() throws Exception
    {
        setupData();

        instance = new BlackNectarSearchRequest();
    }

    private void setupData() throws Exception
    {
        center = one(locations());
        limit = one(positiveIntegers());
        radiusInMeters = one(positiveDoubles());
        searchTerm = one(alphabeticString());

    }

    @Test
    public void testHasRadius()
    {
        assertThat(instance.hasRadius(), is(false));

        instance.radiusInMeters = radiusInMeters;

        if (radiusInMeters > 0)
{'fraction_non_alphanumeric': 0.08471849865951743, 'fraction_numerical': 0.005898123324396783, 'mean_word_length': 4.46484375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4944489', 'n_tokens_mistral': 1696, 'n_tokens_neox': 1587, 'n_words': 392}