<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.ocelotds.web.rest;

import java.io.InputStream;
import java.util.List;
import javax.enterprise.inject.Instance;
import org.junit.Test;
import static org.mockito.Mockito.*;
import static org.assertj.core.api.Assertions.*;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import org.ocelotds.OcelotServices;
import org.ocelotds.objects.FakeCDI;

/**
 *
 * @author hhfrancois
 */
@RunWith(MockitoJUnitRunner.class)
public class RsJsServicesTest {

	@InjectMocks
	@Spy
	RsJsServices instance;
	
	@Spy
	Instance<Object> dataservices = new FakeCDI();

	/**
	 * Test of getStreams method, of class RsJsServices.
	 */
	@Test
	public void testGetStreams() {
		System.out.println("getStreams");
		((FakeCDI) dataservices).add("service1");
		((FakeCDI) dataservices).add("service2");
		((FakeCDI) dataservices).add(new OcelotServices());
		((FakeCDI) dataservices).add("service4");
		doReturn("").when(instance).getClassnameFromProxy(anyObject());
		doReturn("").when(instance).getJsFilename(anyString());
		List<InputStream> result = instance.getStreams();
		verify(instance, times(3)).addStream(any(List.class), anyString());
		assertThat(result).isNotNull();
	}

	/**
	 * Test of getClassnameFromProxy method, of class RsJsServices.
	 */
	@Test
	public void testGetClassnameFromProxy() {
		System.out.println("getClassnameFromProxy");
		Object dataservice = "string";
		String expectResult = dataservice.toString();
		doReturn(null).when(instance).getClassnameFromProxyname(anyString());
		instance.getClassnameFromProxy(dataservice);
		verify(instance).getClassnameFromProxyname(eq(expectResult));
	}<commit_msg>fix test<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.ocelotds.web.rest;

import java.io.InputStream;
import java.util.List;
import javax.enterprise.inject.Instance;
import org.junit.Test;
import static org.mockito.Mockito.*;
import static org.assertj.core.api.Assertions.*;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import org.ocelotds.OcelotServices;
import org.ocelotds.objects.FakeCDI;

/**
 *
 * @author hhfrancois
 */
@RunWith(MockitoJUnitRunner.class)
public class RsJsServicesTest {

	@InjectMocks
	@Spy
	RsJsServices instance;
	
	@Spy
	Instance<Object> dataservices = new FakeCDI();

	/**
	 * Test of getStreams method, of class RsJsServices.
	 */
	@Test
	public void testGetStreams() {
		System.out.println("getStreams");
		((FakeCDI) dataservices).add("service1");
		((FakeCDI) dataservices).add("service2");
		((FakeCDI) dataservices).add(new OcelotServices());
		((FakeCDI) dataservices).add("service4");
		doReturn("").when(instance).getClassnameFromProxy(anyObject());
		doReturn("").when(instance).getJsFilename(anyString());
		List<InputStream> result = instance.getStreams();
		verify(instance, times(4)).addStream(any(List.class), anyString());
		assertThat(result).isNotNull();
	}

	/**
	 * Test of getClassnameFromProxy method, of class RsJsServices.
	 */
	@Test
	public void testGetClassnameFromProxy() {
		System.out.println("getClassnameFromProxy");
		Object dataservice = "string";
		String expectResult = dataservice.toString();
		doReturn(null).when(instance).getClassnameFromProxyname(anyString());
		instance.getClassnameFromProxy(dataservice);
		verify(instance).getClassnameFromProxyname(eq(expectResult));
	}
{'fraction_non_alphanumeric': 0.13635180848295603, 'fraction_numerical': 0.004163413999479573, 'mean_word_length': 5.537414965986395, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4556054', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1250, 'n_words': 259}