<commit_before>package uk.gov.ons.ctp.response.action.message;

import java.util.ArrayList;
import java.util.concurrent.TimeUnit;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import uk.gov.ons.ctp.response.action.message.instruction.ActionRequest;
import uk.gov.ons.ctp.response.action.utility.ActionMessageListener;

import static org.junit.Assert.assertTrue;
import static uk.gov.ons.ctp.response.action.utility.CommonValues.ACTION_INSTRUCTION_XML_BITS;

@ContextConfiguration(locations = { "/InstructionServiceTest-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
public class InstructionPublisherTest {

  private static final String FIELD_HANDLER = "Field";
  private static final String TEST_ACTION_TYPE = "our testActionType";


	@Autowired
	InstructionPublisher instructionPublisher;

	@Autowired
	DefaultMessageListenerContainer actionInstructionMessageListenerContainer;

	@Test
	public void testSendActionInstructionWithInstructionPublisher() throws InterruptedException {
		ActionRequest actionRequest = new ActionRequest();
		actionRequest.setActionType(TEST_ACTION_TYPE);
		ArrayList<ActionRequest> actionRequests = new ArrayList<>();
		actionRequests.add(actionRequest);
		instructionPublisher.sendRequests(FIELD_HANDLER, actionRequests);

		ActionMessageListener listener = (ActionMessageListener)actionInstructionMessageListenerContainer.getMessageListener();
		TimeUnit.SECONDS.sleep(5);
		String listenerPayload = listener.getPayload();
		assertTrue(listenerPayload.contains(ACTION_INSTRUCTION_XML_BITS));
    assertTrue(listenerPayload.contains(TEST_ACTION_TYPE));
	}
}<commit_msg>increasing delay so it succeeds on the overnight build<commit_after>package uk.gov.ons.ctp.response.action.message;

import java.util.ArrayList;
import java.util.concurrent.TimeUnit;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import uk.gov.ons.ctp.response.action.message.instruction.ActionRequest;
import uk.gov.ons.ctp.response.action.utility.ActionMessageListener;

import static org.junit.Assert.assertTrue;
import static uk.gov.ons.ctp.response.action.utility.CommonValues.ACTION_INSTRUCTION_XML_BITS;

@ContextConfiguration(locations = { "/InstructionServiceTest-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
public class InstructionPublisherTest {

  private static final String FIELD_HANDLER = "Field";
  private static final String TEST_ACTION_TYPE = "our testActionType";


	@Autowired
	InstructionPublisher instructionPublisher;

	@Autowired
	DefaultMessageListenerContainer actionInstructionMessageListenerContainer;

	@Test
	public void testSendActionInstructionWithInstructionPublisher() throws InterruptedException {
		ActionRequest actionRequest = new ActionRequest();
		actionRequest.setActionType(TEST_ACTION_TYPE);
		ArrayList<ActionRequest> actionRequests = new ArrayList<>();
		actionRequests.add(actionRequest);
		instructionPublisher.sendRequests(FIELD_HANDLER, actionRequests);

		ActionMessageListener listener = (ActionMessageListener)actionInstructionMessageListenerContainer.getMessageListener();
		TimeUnit.SECONDS.sleep(10);
		String listenerPayload = listener.getPayload();
		assertTrue(listenerPayload.contains(ACTION_INSTRUCTION_XML_BITS));
    assertTrue(listenerPayload.contains(TEST_ACTION_TYPE));
	}
}
{'fraction_non_alphanumeric': 0.08577405857740586, 'fraction_numerical': 0.0023535564853556486, 'mean_word_length': 7.95784543325527, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3528174', 'n_tokens_mistral': 1047, 'n_tokens_neox': 1023, 'n_words': 168}