<commit_before>package com.google.sps;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.google.appengine.tools.development.testing.LocalUserServiceTestConfig;
import com.google.cloud.Date;
import com.google.gson.Gson;
import com.google.sps.data.Event;
import com.google.sps.data.User;
import com.google.sps.data.VolunteeringOpportunity;
import com.google.sps.servlets.EventCreationServlet;
import com.google.sps.servlets.EventRegistrationServlet;
import com.google.sps.utilities.SpannerClient;
import com.google.sps.utilities.SpannerTasks;
import com.google.sps.utilities.SpannerTestTasks;
import com.google.sps.utilities.TestUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.ServletContextEvent;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.springframework.mock.web.MockServletContext;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import java.util.stream.Collectors;
import java.util.stream.Stream; 
import org.mockito.internal.matchers.apachecommons.ReflectionEquals;

/** Unit tests for DatabaseWrapper functionality related to Event class. */
@RunWith(JUnit4.class)
public class EventSpannerTasksTest {
  private static final String HOST_NAME = "<NAME>";
  private static final String EMAIL = "<EMAIL>";
  private static final User HOST = new User.Builder(HOST_NAME, EMAIL).build();
  private static final String ATTENDEE_NAME = "New attendee";
  private static final String ATTENDEE_EMAIL = "<EMAIL>";
  private static final User ATTENDEE = new User.Builder(ATTENDEE_NAME, ATTENDEE_EMAIL).build();
  private static final String EVENT_NAME = "Team Meeting";
  private static final String NEW_EVENT_NAME = "Daily Team Meeting";
  private static final String DESCRIPTION = "Daily Team Sync";
  private static final Set<String> LABELS =
      Collections.unmodifiableSet(new HashSet<>(Arrays.asList("Tech", "Work")));
  private static final String LOCATION = "Remote";
  private static final Date DATE_PAST = Date.fromYearMonthDay(2016, 9, 15);
  private static final Date DATE_FUTURE =
      Date.fromYearMonthDay(new java.util.Date().getYear() + 1, 9, 15);
  private static final String DATE_FUTURE_STRING = DATE_FUTURE.getYear() + "-09-15";
  private static final String TIME = "3:00PM-5:00PM";
  private MockHttpServletRequest request;
  private MockHttpServletResponse response;
  private static final LocalServiceTestHelper authenticationHelper =
      new LocalServiceTestHelper(new LocalUserServiceTestConfig());

  @BeforeClass
  public static void setUp() throws Exception {
    // Mock a request to trigger the SpannerClient setup to run
    MockServletContext mockServletContext = new MockServletContext();
    new SpannerClient().contextInitialized(new ServletContextEvent(mockServletContext));
    SpannerTestTasks.setup();
  }

  @Before 
  public void testSetUp() throws Exception {
    // Host inserted because needed to query getEventById() in db
    SpannerTasks.insertOrUpdateUser(HOST);
    request = new MockHttpServletRequest();
    response = new MockHttpServletResponse();
    authenticationHelper.setUp();
  } 

  @AfterClass
  public static void tearDown() throws Exception {
    SpannerTestTasks.cleanup();<commit_msg>Add new date constraint test<commit_after>package com.google.sps;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.google.appengine.tools.development.testing.LocalUserServiceTestConfig;
import com.google.cloud.Date;
import com.google.gson.Gson;
import com.google.sps.data.Event;
import com.google.sps.data.User;
import com.google.sps.data.VolunteeringOpportunity;
import com.google.sps.servlets.EventCreationServlet;
import com.google.sps.servlets.EventRegistrationServlet;
import com.google.sps.utilities.SpannerClient;
import com.google.sps.utilities.SpannerTasks;
import com.google.sps.utilities.SpannerTestTasks;
import com.google.sps.utilities.TestUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.ServletContextEvent;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.springframework.mock.web.MockServletContext;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import java.util.stream.Collectors;
import java.util.stream.Stream; 
import org.mockito.internal.matchers.apachecommons.ReflectionEquals;

/** Unit tests for DatabaseWrapper functionality related to Event class. */
@RunWith(JUnit4.class)
public class EventSpannerTasksTest {
  private static final String HOST_NAME = "<NAME>";
  private static final String EMAIL = "<EMAIL>";
  private static final User HOST = new User.Builder(HOST_NAME, EMAIL).build();
  private static final String ATTENDEE_NAME = "New attendee";
  private static final String ATTENDEE_EMAIL = "<EMAIL>";
  private static final User ATTENDEE = new User.Builder(ATTENDEE_NAME, ATTENDEE_EMAIL).build();
  private static final String EVENT_NAME = "Team Meeting";
  private static final String NEW_EVENT_NAME = "Daily Team Meeting";
  private static final String DESCRIPTION = "Daily Team Sync";
  private static final Set<String> LABELS =
      Collections.unmodifiableSet(new HashSet<>(Arrays.asList("Tech", "Work")));
  private static final String LOCATION = "Remote";
  private static final Date DATE_PAST = Date.fromYearMonthDay(2016, 9, 15);
  private static final Date DATE_FUTURE =
      Date.fromYearMonthDay(Calendar.getInstance().get(Calendar.YEAR) + 1, 9, 15);
  private static final String DATE_FUTURE_STRING = DATE_FUTURE.getYear() + "-09-15";
  private static final String TIME = "3:00PM-5:00PM";
  private MockHttpServletRequest request;
  private MockHttpServletResponse response;
  private static final LocalServiceTestHelper authenticationHelper =
      new LocalServiceTestHelper(new LocalUserServiceTestConfig());

  @BeforeClass
  public static void setUp() throws Exception {
    // Mock a request to trigger the SpannerClient setup to run
    MockServletContext mockServletContext = new MockServletContext();
    new SpannerClient().contextInitialized(new ServletContextEvent(mockServletContext));
    SpannerTestTasks.setup();
  }

  @Before 
  public void testSetUp() throws Exception {
    // Host inserted because needed to query getEventById() in db
    SpannerTasks.insertOrUpdateUser(HOST);
    request = new MockHttpServletRequest();
    response = new MockHttpServletResponse();
    authenticationHelper.setUp();
  } 

  @AfterClass
  public static void tearDown() throws Exception {
    SpannerTestTasks.cleanup();
{'fraction_non_alphanumeric': 0.09357114335152403, 'fraction_numerical': 0.006122720617596167, 'mean_word_length': 5.62610229276896, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3871462', 'n_tokens_mistral': 2170, 'n_tokens_neox': 2129, 'n_words': 540}