<commit_before>package com.aventstack.extentreports.model.service;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import com.aventstack.extentreports.gherkin.model.IGherkinFormatterModel;
import com.aventstack.extentreports.gherkin.model.ScenarioOutline;
import com.aventstack.extentreports.model.Test;

public class TestService {

	public static Boolean testHasAttributes(Test test) {
		return testHasAuthor(test) || testHasCategory(test) || testHasDevice(test);
	}

	public static Boolean testHasAuthor(Test test) {
		return !test.getAuthorContext().isEmpty();
	}

	public static Boolean testHasCategory(Test test) {
		return !test.getCategoryContext().isEmpty();
	}

	public static Boolean testHasDevice(Test test) {
		return !test.getDeviceContext().isEmpty();
	}

	public static Boolean testHasException(Test test) {
		return !test.getExceptionInfoContext().isEmpty();
	}

	public static Boolean testHasChildren(Test test) {
		return !test.getNodeContext().isEmpty();
	}

	public static Boolean testHasLog(Test test) {
		return !test.getLogContext().isEmpty();
	}

	public static Boolean testHasScreenCapture(Test test) {
		return !test.getScreenCaptureContext().isEmpty();
	}
	
	public static Boolean testHasScreenCapture(Test test, Boolean deep) {
		if (deep) {
			Boolean hasScreenCapture = !test.getScreenCaptureContext().isEmpty() 
				|| test.getLogContext().getAll().stream().anyMatch(LogService::logHasScreenCapture);
			if (!hasScreenCapture) {
				hasScreenCapture = test.getNodeContext().getAll().stream().anyMatch(x -> testHasScreenCapture(x, deep));
			}
			return hasScreenCapture;
		}
		return testHasScreenCapture(test);
	}

	public static Boolean isTestBehaviorDriven(Test test) {
		return test.getBddType() != null;
	}

	public static String getBehaviorDrivenTypeName(Class<? extends IGherkinFormatterModel> bddType)
			throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException,
			InvocationTargetException {
		Method method = bddType.getMethod("getGherkinName");
		Object o = method.invoke(null, (Object[]) null);
		return o.toString();
	}

	public static String getBehaviorDrivenTypeName(Test test) throws NoSuchMethodException, SecurityException,
			IllegalAccessException, IllegalArgumentException, InvocationTargetException {
		return getBehaviorDrivenTypeName(test.getBddType());
	}
<commit_msg>Update TestService.java<commit_after>package com.aventstack.extentreports.model.service;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import com.aventstack.extentreports.gherkin.model.IGherkinFormatterModel;
import com.aventstack.extentreports.gherkin.model.ScenarioOutline;
import com.aventstack.extentreports.model.Test;

public class TestService {

	public static Boolean testHasAttributes(Test test) {
		return testHasAuthor(test) || testHasCategory(test) || testHasDevice(test);
	}

	public static Boolean testHasAuthor(Test test) {
		return test != null && !test.getAuthorContext().isEmpty();
	}

	public static Boolean testHasCategory(Test test) {
		return test != null && !test.getCategoryContext().isEmpty();
	}

	public static Boolean testHasDevice(Test test) {
		return test != null && !test.getDeviceContext().isEmpty();
	}

	public static Boolean testHasException(Test test) {
		return test != null && !test.getExceptionInfoContext().isEmpty();
	}

	public static Boolean testHasChildren(Test test) {
		return test != null && !test.getNodeContext().isEmpty();
	}

	public static Boolean testHasLog(Test test) {
		return test != null && !test.getLogContext().isEmpty();
	}

	public static Boolean testHasScreenCapture(Test test) {
		return test != null && !test.getScreenCaptureContext().isEmpty();
	}
	
	public static Boolean testHasScreenCapture(Test test, Boolean deep) {
		if (deep) {
			Boolean hasScreenCapture = !test.getScreenCaptureContext().isEmpty() 
				|| test.getLogContext().getAll().stream().anyMatch(LogService::logHasScreenCapture);
			if (!hasScreenCapture) {
				hasScreenCapture = test.getNodeContext().getAll().stream().anyMatch(x -> testHasScreenCapture(x, deep));
			}
			return hasScreenCapture;
		}
		return testHasScreenCapture(test);
	}

	public static Boolean isTestBehaviorDriven(Test test) {
		return test != null && test.getBddType() != null;
	}

	public static String getBehaviorDrivenTypeName(Class<? extends IGherkinFormatterModel> bddType)
			throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException,
			InvocationTargetException {
		Method method = bddType.getMethod("getGherkinName");
		Object o = method.invoke(null, (Object[]) null);
		return o.toString();
	}

	public static String getBehaviorDrivenTypeName(Test test) throws NoSuchMethodException, SecurityException,
			IllegalAccessException, IllegalArgumentException, InvocationTargetException {
		return getBehaviorDrivenTypeName(test.getBddType());
	}

{'fraction_non_alphanumeric': 0.10812449474535166, 'fraction_numerical': 0.0, 'mean_word_length': 6.039829302987198, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5031325', 'n_tokens_mistral': 1481, 'n_tokens_neox': 1392, 'n_words': 297}