<commit_before>package com.synopsys.integration.blackduck.service;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.List;
import java.util.Optional;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import com.synopsys.integration.blackduck.api.core.ProjectRequestBuilder;
import com.synopsys.integration.blackduck.api.generated.view.ProjectMappingView;
import com.synopsys.integration.blackduck.api.generated.view.ProjectView;
import com.synopsys.integration.blackduck.rest.IntHttpClientTestHelper;
import com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper;
import com.synopsys.integration.exception.IntegrationException;

@Tag("integration")
class ProjectMappingServiceTest {
    private ProjectMappingService projectMappingService;
    private ProjectView projectView;
    private BlackDuckServicesFactory blackDuckServicesFactory;

    @BeforeEach
    void setUp() throws IntegrationException {
        final IntHttpClientTestHelper intHttpClientTestHelper = new IntHttpClientTestHelper();
        blackDuckServicesFactory = intHttpClientTestHelper.createBlackDuckServicesFactory();
        projectMappingService = blackDuckServicesFactory.createProjectMappingService();
        final ProjectService projectService = blackDuckServicesFactory.createProjectService();
        final String testProjectName = intHttpClientTestHelper.getProperty("TEST_PROJECT");
        final String testProjectVersion = intHttpClientTestHelper.getProperty("TEST_VERSION");

        final Optional<ProjectView> existingProjectView = projectService.getProjectByName(testProjectName);
        if (existingProjectView.isPresent()) {
            final BlackDuckService blackDuckService = blackDuckServicesFactory.createBlackDuckService();
            blackDuckService.delete(existingProjectView.get());
        }

        final ProjectRequestBuilder projectRequestBuilder = new ProjectRequestBuilder(testProjectName, testProjectVersion);
        final ProjectVersionWrapper projectVersionWrapper = projectService.createProject(projectRequestBuilder.build());
        projectView = projectVersionWrapper.getProjectView();
    }

    @AfterEach
    void tearDown() throws IntegrationException {
        final BlackDuckService blackDuckService = blackDuckServicesFactory.createBlackDuckService();
        blackDuckService.delete(projectView);
    }
<commit_msg>Updated test to use syncProjectVersion<commit_after>package com.synopsys.integration.blackduck.service;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.List;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import com.synopsys.integration.blackduck.api.core.ProjectRequestBuilder;
import com.synopsys.integration.blackduck.api.generated.view.ProjectMappingView;
import com.synopsys.integration.blackduck.api.generated.view.ProjectView;
import com.synopsys.integration.blackduck.rest.IntHttpClientTestHelper;
import com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper;
import com.synopsys.integration.exception.IntegrationException;

@Tag("integration")
class ProjectMappingServiceTest {
    private ProjectMappingService projectMappingService;
    private ProjectView projectView;
    private BlackDuckServicesFactory blackDuckServicesFactory;

    @BeforeEach
    void setUp() throws IntegrationException {
        final IntHttpClientTestHelper intHttpClientTestHelper = new IntHttpClientTestHelper();
        blackDuckServicesFactory = intHttpClientTestHelper.createBlackDuckServicesFactory();
        projectMappingService = blackDuckServicesFactory.createProjectMappingService();
        final ProjectService projectService = blackDuckServicesFactory.createProjectService();
        final String testProjectName = intHttpClientTestHelper.getProperty("TEST_PROJECT");
        final String testProjectVersion = intHttpClientTestHelper.getProperty("TEST_VERSION");

        final ProjectRequestBuilder projectRequestBuilder = new ProjectRequestBuilder(testProjectName, testProjectVersion);
        final ProjectVersionWrapper projectVersionWrapper = projectService.syncProjectAndVersion(projectRequestBuilder.build());
        projectView = projectVersionWrapper.getProjectView();
    }

    @AfterEach
    void tearDown() throws IntegrationException {
        final BlackDuckService blackDuckService = blackDuckServicesFactory.createBlackDuckService();
        blackDuckService.delete(projectView);
    }

{'fraction_non_alphanumeric': 0.07374758116534079, 'fraction_numerical': 0.0, 'mean_word_length': 5.742028985507246, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '834903', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1158, 'n_words': 191}