<commit_before>package com.vaadin.tests.components;

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

import com.vaadin.terminal.UserError;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Layout.SpacingHandler;

public abstract class ComponentTestCase<T extends AbstractComponent> extends
        TestBase {

    private List<T> testComponents = new ArrayList<T>();

    @Override
    protected void setup() {
        ((SpacingHandler) getLayout()).setSpacing(true);
        addComponent(createActionLayout());
    }

    @Override
    protected String getDescription() {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    protected Integer getTicketNumber() {
        // TODO Auto-generated method stub
        return null;
    }

    protected abstract List<Component> createActions();

    private Component createActionLayout() {
        HorizontalLayout actionLayout = new HorizontalLayout();
        actionLayout.setSpacing(true);
        actionLayout.setMargin(true);
        for (Component c : createActions()) {
            actionLayout.addComponent(c);
        }
        addComponent(actionLayout);
        return actionLayout;
    }

    protected void addTestComponent(T c) {
        testComponents.add(c);
        addComponent(c);
    }

    protected List<T> getTestComponents() {
        return testComponents;
    }

    protected void setErrorIndicators(boolean on) {
        for (T c : getTestComponents()) {
            if (c == null) {
                continue;
            }

            if (on) {
                c.setComponentError(new UserError("It failed!"));
            } else {
                c.setComponentError(null);

            }
        }

    }

    protected void setRequired(boolean on) {

        for (T c : getTestComponents()) {
            if (c == null) {
                continue;
            }

            if (c instanceof AbstractField) {
                ((AbstractField) c).setRequired(on);
            }

        }

    }

    protected void setEnabled(boolean on) {
        for (T c : getTestComponents()) {
            if (c == null) {
                continue;
            }

            c.setEnabled(on);
        }

    }

    protected void setReadOnly(boolean on) {
        for (T c : getTestComponents()) {
            if (c == null) {
                continue;
            }

            c.setReadOnly(on);
        }

    }

}
<commit_msg>Force test cases to implement getDescription()<commit_after>package com.vaadin.tests.components;

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

import com.vaadin.terminal.UserError;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Layout.SpacingHandler;

public abstract class ComponentTestCase<T extends AbstractComponent> extends
        TestBase {

    private List<T> testComponents = new ArrayList<T>();

    @Override
    protected void setup() {
        ((SpacingHandler) getLayout()).setSpacing(true);
        addComponent(createActionLayout());
    }

    @Override
    protected Integer getTicketNumber() {
        return null;
    }

    protected abstract List<Component> createActions();

    private Component createActionLayout() {
        HorizontalLayout actionLayout = new HorizontalLayout();
        actionLayout.setSpacing(true);
        actionLayout.setMargin(true);
        for (Component c : createActions()) {
            actionLayout.addComponent(c);
        }
        addComponent(actionLayout);
        return actionLayout;
    }

    protected void addTestComponent(T c) {
        testComponents.add(c);
        addComponent(c);
    }

    protected List<T> getTestComponents() {
        return testComponents;
    }

    protected void setErrorIndicators(boolean on) {
        for (T c : getTestComponents()) {
            if (c == null) {
                continue;
            }

            if (on) {
                c.setComponentError(new UserError("It failed!"));
            } else {
                c.setComponentError(null);

            }
        }

    }

    protected void setRequired(boolean on) {

        for (T c : getTestComponents()) {
            if (c == null) {
                continue;
            }

            if (c instanceof AbstractField) {
                ((AbstractField) c).setRequired(on);
            }

        }

    }

    protected void setEnabled(boolean on) {
        for (T c : getTestComponents()) {
            if (c == null) {
                continue;
            }

            c.setEnabled(on);
        }

    }

    protected void setReadOnly(boolean on) {
        for (T c : getTestComponents()) {
            if (c == null) {
                continue;
            }

            c.setReadOnly(on);
        }

    }

}

{'fraction_non_alphanumeric': 0.09961839726852782, 'fraction_numerical': 0.0, 'mean_word_length': 1.903790087463557, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '136265', 'n_tokens_mistral': 1369, 'n_tokens_neox': 1295, 'n_words': 297}