<commit_before>package de.hshannover.f4.trust.irondetect.policy.publisher;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doCallRealMethod;
import static org.mockito.Mockito.mock;

import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.w3c.dom.Document;

import de.hshannover.f4.trust.ifmapj.identifier.Identifier;
import de.hshannover.f4.trust.irondetect.model.Policy;
import de.hshannover.f4.trust.irondetect.policy.parser.PolicyFactory;

public class PolicyPublisherTest {
	
	private static final Logger mLog = Logger.getLogger(PolicyPublisherTest.class);

	private Policy mPolicy;

	private PolicyPublisher mPolicyPublisher;

	@Before
	public void setUp() throws Exception {
		mPolicy = PolicyFactory.readPolicy("src/test/resources/MobileDeviceSzenario.pol");

		mPolicyPublisher = mock(PolicyPublisher.class);
		mPolicyPublisher.mPolicy = mPolicy;
		doCallRealMethod().when(mPolicyPublisher).buildPublishUpdate();
		doCallRealMethod().when(mPolicyPublisher).addPublishUpdate(any(Identifier.class), any(Document.class),
				any(Identifier.class));
	}

	@After
	public void tearDown() {

	}

	@Test
	public void expected_rightPublishUpdatesSize() {

		try {<commit_msg>[fixed] PolicyPublisherTest<commit_after>package de.hshannover.f4.trust.irondetect.policy.publisher;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doCallRealMethod;
import static org.mockito.Mockito.mock;

import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.w3c.dom.Document;

import de.hshannover.f4.trust.ifmapj.identifier.Identifier;
import de.hshannover.f4.trust.ifmapj.identifier.Identifiers;
import de.hshannover.f4.trust.irondetect.model.Policy;
import de.hshannover.f4.trust.irondetect.policy.parser.PolicyFactory;

@RunWith(PowerMockRunner.class)
@PrepareForTest(Identifiers.class)
public class PolicyPublisherTest {

	private static final Logger mLog = Logger.getLogger(PolicyPublisherTest.class);

	private Policy mPolicy;

	private PolicyPublisher mPolicyPublisher;

	@Before
	public void setUp() throws Exception {

		PowerMockito.mockStatic(Identifiers.class);
		PowerMockito.doNothing().when(Identifiers.class, "registerIdentifierHandler", any());

		mPolicy = PolicyFactory.readPolicy("src/test/resources/MobileDeviceSzenario.pol");

		mPolicyPublisher = mock(PolicyPublisher.class);
		mPolicyPublisher.mPolicy = mPolicy;
		doCallRealMethod().when(mPolicyPublisher).buildPublishUpdate();
		doCallRealMethod().when(mPolicyPublisher).addPublishUpdate(any(Identifier.class), any(Document.class),
				any(Identifier.class));
	}

	@After
	public void tearDown() {

	}

	@Test
	public void expected_rightPublishUpdatesSize() {

		try {
{'fraction_non_alphanumeric': 0.10635619886721208, 'fraction_numerical': 0.004405286343612335, 'mean_word_length': 6.291284403669724, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3441191', 'n_tokens_mistral': 1086, 'n_tokens_neox': 990, 'n_words': 163}