<commit_before>package edu.duke.cabig.c3pr.utils;

import java.util.ArrayList;
import java.util.List;

import org.acegisecurity.Authentication;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.userdetails.User;
import org.easymock.classextension.EasyMock;

import edu.duke.cabig.c3pr.AbstractTestCase;
import edu.duke.cabig.c3pr.accesscontrol.AuthorizedUser;
import edu.duke.cabig.c3pr.accesscontrol.UserPrivilege;
import edu.duke.cabig.c3pr.constants.RoleTypes;
import edu.duke.cabig.c3pr.constants.UserPrivilegeType;

public class SecurityUtilsTest extends AbstractTestCase {

	Authentication authentication;
	
	List<RoleTypes> roleTypes;
	
	@Override
	protected void setUp() throws Exception {
		super.setUp();
		authentication = registerMockFor(Authentication.class);
		roleTypes = new ArrayList<RoleTypes>();
	}
	
	public void testIsSuperUserTrue(){<commit_msg>setting the security context back to default one instead of mocked one.<commit_after>package edu.duke.cabig.c3pr.utils;

import java.util.ArrayList;
import java.util.List;

import org.acegisecurity.Authentication;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.userdetails.User;
import org.easymock.classextension.EasyMock;

import edu.duke.cabig.c3pr.AbstractTestCase;
import edu.duke.cabig.c3pr.accesscontrol.AuthorizedUser;
import edu.duke.cabig.c3pr.accesscontrol.UserPrivilege;
import edu.duke.cabig.c3pr.constants.RoleTypes;
import edu.duke.cabig.c3pr.constants.UserPrivilegeType;

public class SecurityUtilsTest extends AbstractTestCase {

	Authentication authentication;
	
	List<RoleTypes> roleTypes;
	
	SecurityContext defaultSecurityContext;
	
	@Override
	protected void setUp() throws Exception {
		super.setUp();
		authentication = registerMockFor(Authentication.class);
		roleTypes = new ArrayList<RoleTypes>();
		defaultSecurityContext = SecurityContextHolder.getContext();
	}
	
	@Override
	protected void tearDown() throws Exception {
		SecurityContextHolder.setContext(defaultSecurityContext);
		super.tearDown();
	}
	
	public void testIsSuperUserTrue(){
{'fraction_non_alphanumeric': 0.09003496503496504, 'fraction_numerical': 0.005244755244755245, 'mean_word_length': 6.554455445544554, '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': '5632473', 'n_tokens_mistral': 760, 'n_tokens_neox': 731, 'n_words': 126}