<commit_before>package com.microsoft.bingads.api.test.entities;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.microsoft.bingads.bulk.BulkFileReader;
import com.microsoft.bingads.bulk.BulkFileWriter;
import com.microsoft.bingads.bulk.DownloadFileType;
import com.microsoft.bingads.bulk.ResultFileType;
import com.microsoft.bingads.bulk.entities.BulkEntity;
import org.junit.Assert;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

public class Util {

    public static synchronized ArrayList<BulkEntity> WriteAndReadBack(ArrayList<BulkEntity> entities) {
        ArrayList<BulkEntity> results = new ArrayList<BulkEntity>();
        try {
            String filePath = File.createTempFile("WriteAndReadBack", ".tmp").getAbsolutePath();
            BulkFileWriter writer = new BulkFileWriter(new File(filePath), DownloadFileType.CSV);
            for (BulkEntity entity: entities) {
                writer.writeEntity(entity);
            }
            writer.close();
            BulkFileReader reader = new BulkFileReader(new File(filePath), ResultFileType.FULL_DOWNLOAD, DownloadFileType.CSV);
            for (BulkEntity entity: reader.getEntities()) {
                results.add(entity);
            }
            reader.close();
            new File(filePath).delete();
        } catch (IOException ex) {
            Assert.fail("Exceptions while writing or reading file");
        }
        return results;
    }

    public static String toJson(Object obj) {
        ObjectWriter writer = new ObjectMapper().writer().withDefaultPrettyPrinter();
        String result = null;
        try {
            result = writer.writeValueAsString(obj);
        } catch (JsonProcessingException e) {
            Assert.fail("Cannot serialize the object to JSON");
        }
        return result;
    }
}<commit_msg>Code style change<commit_after>package com.microsoft.bingads.api.test.entities;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.microsoft.bingads.bulk.BulkFileReader;
import com.microsoft.bingads.bulk.BulkFileWriter;
import com.microsoft.bingads.bulk.DownloadFileType;
import com.microsoft.bingads.bulk.ResultFileType;
import com.microsoft.bingads.bulk.entities.BulkEntity;
import org.junit.Assert;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

public class Util {

    public static synchronized ArrayList<BulkEntity> WriteAndReadBack(ArrayList<BulkEntity> entities) {
        ArrayList<BulkEntity> results = new ArrayList<BulkEntity>();

        try {
            File tempFile = File.createTempFile("WriteAndReadBack", ".tmp");
            BulkFileWriter writer = new BulkFileWriter(tempFile, DownloadFileType.CSV);

            for (BulkEntity entity: entities) {
                writer.writeEntity(entity);
            }

            writer.close();

            BulkFileReader reader = new BulkFileReader(tempFile, ResultFileType.FULL_DOWNLOAD, DownloadFileType.CSV);

            for (BulkEntity entity: reader.getEntities()) {
                results.add(entity);
            }

            reader.close();

            tempFile.delete();
        } catch (IOException ex) {
            Assert.fail("Exceptions while writing or reading file");
        }

        return results;
    }

    public static String toJson(Object obj) {
        ObjectWriter writer = new ObjectMapper().writer().withDefaultPrettyPrinter();

        String result = null;

        try {
            result = writer.writeValueAsString(obj);
        } catch (JsonProcessingException e) {
            Assert.fail("Cannot serialize the object to JSON");
        }

        return result;
    }
}
{'fraction_non_alphanumeric': 0.0970550576184379, 'fraction_numerical': 0.0, 'mean_word_length': 2.9295774647887325, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7659471', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1018, 'n_words': 215}