<commit_before>package com.codingbrothers.futurimages.config;

import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;

import com.codingbrothers.futurimages.util.RequestContext;
import com.google.inject.Key;
import com.google.inject.Provider;
import com.google.inject.Scope;


public class TestRequestScope implements Scope {

	private final Provider<RequestContext> reqCtxProvider = new Provider<RequestContext>() {

		@Override
		public RequestContext get() {
			HttpServletRequest req = mock(HttpServletRequest.class);
			doReturn(Locale.getDefault()).when(req).getLocale();
			return new RequestContext(req);
		}
	};
	
	@Override
	@SuppressWarnings("unchecked")
	public <T> Provider<T> scope(Key<T> key, Provider<T> unscoped) {
		if(RequestContext.class.isAssignableFrom(key.getTypeLiteral().getType().getClass())) {
			return (Provider<T>) reqCtxProvider;
		}
		return unscoped;
	}

}<commit_msg>Tiny TestRequestScope change<commit_after>package com.codingbrothers.futurimages.config;

import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;

import java.util.Arrays;
import java.util.Locale;

import javax.servlet.http.HttpServletRequest;

import com.codingbrothers.futurimages.util.RequestContext;
import com.google.common.collect.Iterators;
import com.google.inject.Key;
import com.google.inject.Provider;
import com.google.inject.Scope;

public class TestRequestScope implements Scope {

	private final Provider<RequestContext> reqCtxProvider = new Provider<RequestContext>() {

		@Override
		public RequestContext get() {
			HttpServletRequest req = mock(HttpServletRequest.class);
			doReturn(Locale.getDefault()).when(req).getLocale();
			doReturn(Iterators.asEnumeration(Arrays.asList(Locale.getDefault()).iterator())).when(req).getLocales();
			return new RequestContext(req);
		}
	};

	@Override
	@SuppressWarnings("unchecked")
	public <T> Provider<T> scope(Key<T> key, Provider<T> unscoped) {
		if (RequestContext.class.isAssignableFrom(key.getTypeLiteral().getType().getClass())) {
			return (Provider<T>) reqCtxProvider;
		}
		return unscoped;
	}

}
{'fraction_non_alphanumeric': 0.12061902594446973, 'fraction_numerical': 0.0, 'mean_word_length': 6.044871794871795, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4232285', 'n_tokens_mistral': 707, 'n_tokens_neox': 680, 'n_words': 122}