<commit_before>package exh3y.telebot.data;

import static org.junit.Assert.*;

import java.util.Random;

import org.json.JSONObject;
import org.junit.Test;

import exh3y.telebot.testutil.StringGenerator;

public class TelegramMessageTest {

	@Test
	public void testMessageCreation() {

		JSONObject json = new JSONObject(
				"{\"message_id\":42,\"from\":{\"id\":547885,\"first_name\":\"Some\",\"last_name\":\"User\",\"username\":\"testuser\"},\"chat\":{\"id\":1337,\"first_name\":\"Some\",\"last_name\":\"User\",\"username\":\"testuser\",\"type\":\"private\"},\"date\":1450006107,\"text\":\"This is a test message.\"}");
		TelegramMessage telemessage = new TelegramMessage(json);

		assertTrue(telemessage.getText().equals("This is a test message."));
		assertTrue(telemessage.getChatId() == 1337);

	}

	@Test
	public void testMessageToCommandArray() {

		Random rand = new Random();
		StringGenerator stringGenerator = new StringGenerator();

		for (int count = 1; count < 10; count = count + 2) {
			String[] commandArray = new String[count];
			String commandString = "";
			for (int i = 0; i < commandArray.length; i++) {
				commandArray[i] = "str" + stringGenerator.randomString(rand.nextInt(24) + 1);
				commandString += commandArray[i];

				if (i < commandArray.length - 1) {
					commandString += " ";
				}
			}

			System.out.println("Length of tested command: \t" + commandArray.length + " items");
			System.out.println("Total length: \t\t\t" + commandString.length() + "");

			for (int i = 0; i < 10; i++) {
<commit_msg>Updated JUnit test<commit_after>package exh3y.telebot.data;

import static org.junit.Assert.*;

import java.util.Random;

import org.json.JSONObject;
import org.junit.Test;

import exh3y.telebot.testutil.StringGenerator;

public class TelegramMessageTest {

	@Test
	public void testMessageCreation() {

		JSONObject json = new JSONObject(
				"{\"message_id\":42,\"from\":{\"id\":547885,\"first_name\":\"Some\",\"last_name\":\"User\",\"username\":\"testuser\"},\"chat\":{\"id\":1337,\"first_name\":\"Some\",\"last_name\":\"User\",\"username\":\"testuser\",\"type\":\"private\"},\"date\":1450006107,\"text\":\"This is a test message.\"}");
		TelegramMessage telemessage = new TelegramMessage(json);

		assertTrue(telemessage.getText().equals("This is a test message."));
		assertTrue(telemessage.getChatId() == 1337);

	}

	@Test
	public void testMessageToCommandArray() {

		Random rand = new Random();
		StringGenerator stringGenerator = new StringGenerator();

		for (int count = 1; count <= 20; count = count + 5) {
			String[] commandArray = new String[count];
			
			if (count == 1) {
				count = 0;
			}
			
			String commandString = "";
			for (int i = 0; i < commandArray.length; i++) {
				commandArray[i] = "str" + stringGenerator.randomString(rand.nextInt(24) + 1);
				commandString += commandArray[i];

				if (i < commandArray.length - 1) {
					commandString += " ";
				}
			}

			System.out.println("Length of tested command: \t" + commandArray.length + " items");
			System.out.println("Total length: \t\t\t" + commandString.length() + "");

			for (int i = 0; i < 10; i++) {

{'fraction_non_alphanumeric': 0.1905521864028088, 'fraction_numerical': 0.026172997127353975, 'mean_word_length': 3.943217665615142, 'pattern_counts': {'":': 28, '<': 11, '<?xml version=': 0, '>': 3, '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': '3522679', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1003, 'n_words': 213}