/*-
 *  Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
 * 
 *  This file is part of CityDoctor2.
 *
 *  CityDoctor2 is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  CityDoctor2 is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with CityDoctor2.  If not, see <https://www.gnu.org/licenses/>.
 */
package de.hft.stuttgart.citydoctor2.checks;

import static org.junit.Assert.assertEquals;

import java.util.List;

import org.junit.Test;

import de.hft.stuttgart.citydoctor2.check.Check;
import de.hft.stuttgart.citydoctor2.check.CheckId;
import de.hft.stuttgart.citydoctor2.check.CheckResult;
import de.hft.stuttgart.citydoctor2.check.CheckType;
import de.hft.stuttgart.citydoctor2.check.Checkable;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ResultStatus;
import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding;
import de.hft.stuttgart.citydoctor2.datastructure.Building;

public class CheckContainerTest {

	@Test
	public void testExceptionCheck() {
		Check c = new Check(CheckId.C_GE_P_HOLE_OUTSIDE) {

			@Override
			public List<Class<? extends Checkable>> getApplicableToClasses() {
				return null;
			}
			
			@Override
			public void check(AbstractBuilding ab) {
				throw new RuntimeException();
			}

			@Override
			public CheckType getType() {
				return null;
			}

			@Override
			public Check createNewInstance() {
				return null;
			}
			
		};
		CheckContainer cc = new CheckContainer(c);
		AbstractBuilding ab = new Building();
		cc.check(ab);
		CheckResult cr = ab.getCheckResult(c.getCheckId());
		assertEquals(ResultStatus.ERROR, cr.getResultStatus());
		assertEquals(ErrorId.UNKNOWN_ERROR, cr.getError().getErrorId());
	}

}
