<commit_before>package com.matthewtamlin.spyglass.library.handler_adapters;

import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;

import com.matthewtamlin.spyglass.library.handler_annotations.DrawableHandler;

import static com.matthewtamlin.java_utilities.checkers.NullChecker.checkNotNull;

public class DrawableHandlerAdapter implements HandlerAdapter<Drawable, DrawableHandler> {
	@Override
	public boolean attributeValueIsAvailable(final TypedArray attrs,
			final DrawableHandler annotation) {
		checkNotNull(attrs, "Argument \'attrs\' cannot be null.");
		checkNotNull(annotation, "Argument \'annotation\' cannot be null.");

		return attrs.getDrawable(annotation.attributeId()) != null;
	}

	@Override
	public Drawable getAttributeValue(final TypedArray attrs, final DrawableHandler annotation) {
		checkNotNull(attrs, "Argument \'attrs\' cannot be null.");
		checkNotNull(annotation, "Argument \'annotation\' cannot be null.");

		if (attributeValueIsAvailable(attrs, annotation)) {
			return attrs.getDrawable(annotation.attributeId());
		} else {
			throw new RuntimeException("No attribute found for ID " + annotation.attributeId());
		}
	}

	@Override
	public boolean attributeIsMandatory(final DrawableHandler annotation) {
		checkNotNull(annotation, "Argument \'annotation\' cannot be null.");

		return annotation.mandatory();
	}
}<commit_msg>Added @Tested annotation<commit_after>package com.matthewtamlin.spyglass.library.handler_adapters;

import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;

import com.matthewtamlin.java_utilities.testing.Tested;
import com.matthewtamlin.spyglass.library.handler_annotations.DrawableHandler;

import static com.matthewtamlin.java_utilities.checkers.NullChecker.checkNotNull;

@Tested(testMethod = "automated")
public class DrawableHandlerAdapter implements HandlerAdapter<Drawable, DrawableHandler> {
	@Override
	public boolean attributeValueIsAvailable(final TypedArray attrs,
			final DrawableHandler annotation) {
		checkNotNull(attrs, "Argument \'attrs\' cannot be null.");
		checkNotNull(annotation, "Argument \'annotation\' cannot be null.");

		return attrs.getDrawable(annotation.attributeId()) != null;
	}

	@Override
	public Drawable getAttributeValue(final TypedArray attrs, final DrawableHandler annotation) {
		checkNotNull(attrs, "Argument \'attrs\' cannot be null.");
		checkNotNull(annotation, "Argument \'annotation\' cannot be null.");

		if (attributeValueIsAvailable(attrs, annotation)) {
			return attrs.getDrawable(annotation.attributeId());
		} else {
			throw new RuntimeException("No attribute found for ID " + annotation.attributeId());
		}
	}

	@Override
	public boolean attributeIsMandatory(final DrawableHandler annotation) {
		checkNotNull(annotation, "Argument \'annotation\' cannot be null.");

		return annotation.mandatory();
	}
}
{'fraction_non_alphanumeric': 0.10350816255644321, 'fraction_numerical': 0.0, 'mean_word_length': 6.2727272727272725, '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': '5716207', 'n_tokens_mistral': 841, 'n_tokens_neox': 783, 'n_words': 196}