All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.novatec.testit.livingdoc.reflect.DuplicateAnnotatedFixturesFoundException Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
package info.novatec.testit.livingdoc.reflect;

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


@SuppressWarnings("serial")
public class DuplicateAnnotatedFixturesFoundException extends RuntimeException {

    private final List> foundFixtures = new ArrayList>();
    private final List> foundAliases = new ArrayList>();

    public DuplicateAnnotatedFixturesFoundException(List> foundAnnotatedClasses,
        List> foundAliasClasses) {
        super();

        foundFixtures.addAll(foundAnnotatedClasses);
        foundAliases.addAll(foundAliasClasses);
    }

    public DuplicateAnnotatedFixturesFoundException(List> matches) {
        foundAliases.addAll(matches);
    }

    @Override
    public String getMessage() {
        String message = "";

        if (foundFixtures.size() > 1) {
            message = message + "Following annotated fixtures have been found in doubles: \n";
            for (Class< ? > str : foundFixtures) {
                message = message + str.getName() + "\n";
            }
        }
        if (foundAliases.size() > 1) {
            message = message + "Following aliases of annotated fixtures have been found in doubles: \n";
            for (Class< ? > str : foundAliases) {
                message = message + str.getName() + "\n";
            }
        }
        return message;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy