<commit_before>package com.github.kolorobot.web.validation;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import org.springframework.beans.factory.annotation.Autowired;

import com.github.kolorobot.domain.UserRepository;
import com.github.kolorobot.web.form.RegistrationForm;

public class UniqueUsernameValidator implements
		ConstraintValidator<UniqueUsername, RegistrationForm> {

	private UserRepository userRepository;
	
	public UniqueUsernameValidator() {
		// hard-coded dependency creation makes the code hard to test
		userRepository = new UserRepository();
	}
	
//	@Autowired
//	public void setUserRepository(UserRepository userRepository) {
//		this.userRepository = userRepository;
//	}
	
	@Override
	public void initialize(UniqueUsername constraintAnnotation) {
		// intentionally left blank
	}

	@Override<commit_msg>Removed setter to not show audience how to solve the problem<commit_after>package com.github.kolorobot.web.validation;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import org.springframework.beans.factory.annotation.Autowired;

import com.github.kolorobot.domain.UserRepository;
import com.github.kolorobot.web.form.RegistrationForm;

public class UniqueUsernameValidator implements
		ConstraintValidator<UniqueUsername, RegistrationForm> {

	private UserRepository userRepository;
	
	public UniqueUsernameValidator() {
		// what is wrong here?
		userRepository = new UserRepository();
	}
	
	@Override
	public void initialize(UniqueUsername constraintAnnotation) {
		// intentionally left blank
	}

	@Override
{'fraction_non_alphanumeric': 0.07650273224043716, 'fraction_numerical': 0.0, 'mean_word_length': 5.953586497890296, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3023630', 'n_tokens_mistral': 440, 'n_tokens_neox': 415, 'n_words': 99}