/******************************************************************************* * Copyright (c) 2015 Red Hat, Inc. * Distributed under license by Red Hat, Inc. All rights reserved. * This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Red Hat, Inc. - initial API and implementation ******************************************************************************/ package org.jboss.tools.cdi.extension.core.test.batch; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages; import org.jboss.tools.tests.AbstractResourceMarkerTest; import junit.framework.TestCase; public class BatchValidationTest extends TestCase { protected IProject getTestProject() throws Exception { return ResourcesPlugin.getWorkspace().getRoot().getProject(BatchCoreTestSetup.PROJECT_NAME); } public void testBatchInjection() throws Exception { IFile file = getTestProject().getFile("src/cdi/test/extension/BatchArtifact.java"); AbstractResourceMarkerTest.assertMarkerIsCreated(file, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS[1], 20); assertNoError(file, 14, 17, 23); } private void assertNoError(IFile file, Integer... integers) throws Exception { for (Integer integer : integers) { AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS[1], integer); AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS[1], integer); } } }