<commit_before>package org.jboss.aerogear.unifiedpush.cassandra.test.integration;

import static org.junit.Assert.assertTrue;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.UUID;

import org.jboss.aerogear.unifiedpush.api.Alias;
import org.jboss.aerogear.unifiedpush.cassandra.dao.model.User;
import org.jboss.aerogear.unifiedpush.cassandra.dao.model.User.AliasType;
import org.jboss.aerogear.unifiedpush.utils.UUIDToDate;
import org.junit.Test;

import com.datastax.driver.core.utils.UUIDs;

public class UUIDToDateTest {

	@Test
	public void uuidToDateTest() {
		for (int i = 1; i < 100; i++) {
			long fromUUid = UUIDToDate.getTimeFromUUID(UUIDs.timeBased());
			long time = System.currentTimeMillis();

			// Assert take into account, that UUIDToDate.getTimeFromUUID might
			// delay in 1 millisecond
			assertTrue(time - fromUUid <= 1);
		}
	}

	@Test
	public void uuidShouldFail() {
		try {
			UUIDToDate.getTimeFromUUID(UUID.randomUUID());
			assertTrue("Should never pass", true);
		} catch (Exception e) {
			// Do nothing
		}
	}

	@Test
	public void uuidNull() {
		assertTrue(UUID.fromString("13814000-1dd2-11b2-8080-808080808080")
				.equals(UUIDs.startOf(Instant.EPOCH.toEpochMilli())));
	}

	@Test
	public void testUserDates() {
		User user = User.copy(new Alias(UUID.randomUUID(), UUIDs.timeBased()), "123456789", AliasType.OTHER.ordinal());
		assertTrue(user.getDay().intValue() == LocalDateTime.now(ZoneOffset.UTC).getDayOfMonth());
		assertTrue(user.getMonth().intValue() == LocalDateTime.now().getMonthValue());
	}
}
<commit_msg>Increase optional delay in uuidToDateTest to 5 millisecond<commit_after>package org.jboss.aerogear.unifiedpush.cassandra.test.integration;

import static org.junit.Assert.assertTrue;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.UUID;

import org.jboss.aerogear.unifiedpush.api.Alias;
import org.jboss.aerogear.unifiedpush.cassandra.dao.model.User;
import org.jboss.aerogear.unifiedpush.cassandra.dao.model.User.AliasType;
import org.jboss.aerogear.unifiedpush.utils.UUIDToDate;
import org.junit.Test;

import com.datastax.driver.core.utils.UUIDs;

public class UUIDToDateTest {

	@Test
	public void uuidToDateTest() {
		for (int i = 1; i < 100; i++) {
			long fromUUid = UUIDToDate.getTimeFromUUID(UUIDs.timeBased());
			long time = System.currentTimeMillis();

			// Assert take into account, that UUIDToDate.getTimeFromUUID might
			// delay in 5 millisecond
			assertTrue(time - fromUUid <= 5);
		}
	}

	@Test
	public void uuidShouldFail() {
		try {
			UUIDToDate.getTimeFromUUID(UUID.randomUUID());
			assertTrue("Should never pass", true);
		} catch (Exception e) {
			// Do nothing
		}
	}

	@Test
	public void uuidNull() {
		assertTrue(UUID.fromString("13814000-1dd2-11b2-8080-808080808080")
				.equals(UUIDs.startOf(Instant.EPOCH.toEpochMilli())));
	}

	@Test
	public void testUserDates() {
		User user = User.copy(new Alias(UUID.randomUUID(), UUIDs.timeBased()), "123456789", AliasType.OTHER.ordinal());
		assertTrue(user.getDay().intValue() == LocalDateTime.now(ZoneOffset.UTC).getDayOfMonth());
		assertTrue(user.getMonth().intValue() == LocalDateTime.now().getMonthValue());
	}
}

{'fraction_non_alphanumeric': 0.1356244246701442, 'fraction_numerical': 0.027308990487879718, 'mean_word_length': 4.821428571428571, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6726079', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1185, 'n_words': 197}