Return-Path: Delivered-To: apmail-maven-m2-dev-archive@www.apache.org Received: (qmail 37240 invoked from network); 29 Mar 2005 05:28:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Mar 2005 05:28:25 -0000 Received: (qmail 84268 invoked by uid 500); 29 Mar 2005 05:28:24 -0000 Delivered-To: apmail-maven-m2-dev-archive@maven.apache.org Received: (qmail 84237 invoked by uid 500); 29 Mar 2005 05:28:24 -0000 Mailing-List: contact m2-dev-help@maven.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Maven 2 Developers List" Reply-To: "Maven 2 Developers List" Delivered-To: mailing list m2-dev@maven.apache.org Received: (qmail 84223 invoked by uid 500); 29 Mar 2005 05:28:24 -0000 Delivered-To: apmail-maven-components-cvs@apache.org Received: (qmail 84220 invoked by uid 99); 29 Mar 2005 05:28:24 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 28 Mar 2005 21:28:24 -0800 Received: (qmail 37223 invoked by uid 1881); 29 Mar 2005 05:28:23 -0000 Date: 29 Mar 2005 05:28:23 -0000 Message-ID: <20050329052823.37222.qmail@minotaur.apache.org> From: jdcasey@apache.org To: maven-components-cvs@apache.org Subject: cvs commit: maven-components/maven-plugin/src/test/java/org/apache/maven/plugin/util/scan/mapping SuffixMappingTest.java X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N jdcasey 2005/03/28 21:28:23 Added: maven-plugin/src/test/java/org/apache/maven/plugin/util/scan/mapping SuffixMappingTest.java Log: forgot one. Revision Changes Path 1.1 maven-components/maven-plugin/src/test/java/org/apache/maven/plugin/util/scan/mapping/SuffixMappingTest.java Index: SuffixMappingTest.java =================================================================== package org.apache.maven.plugin.util.scan.mapping; /* * Copyright 2001-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import org.apache.maven.plugin.util.scan.InclusionScanException; import org.apache.maven.plugin.util.scan.mapping.SuffixMapping; import java.io.File; import java.util.HashSet; import java.util.Set; import junit.framework.TestCase; /** * @author jdcasey */ public class SuffixMappingTest extends TestCase { public void testShouldReturnSingleClassFileForSingleJavaFile() throws InclusionScanException { String base = "path/to/file"; File basedir = new File("."); SuffixMapping mapping = new SuffixMapping(".java", ".class"); Set results = mapping.getTargetFiles(basedir, base + ".java"); assertEquals("Returned wrong number of target files.", 1, results.size()); assertEquals("Target file is wrong.", new File(basedir, base + ".class"), results.iterator().next()); } public void testShouldNotReturnClassFileWhenSourceFileHasWrongSuffix() throws InclusionScanException { String base = "path/to/file"; File basedir = new File("."); SuffixMapping mapping = new SuffixMapping(".java", ".class"); Set results = mapping.getTargetFiles(basedir, base + ".xml"); assertTrue("Returned wrong number of target files.", results.isEmpty()); } public void testShouldReturnOneClassFileAndOneXmlFileForSingleJavaFile() throws InclusionScanException { String base = "path/to/file"; File basedir = new File("."); Set targets = new HashSet(); targets.add(".class"); targets.add(".xml"); SuffixMapping mapping = new SuffixMapping(".java", targets); Set results = mapping.getTargetFiles(basedir, base + ".java"); assertEquals("Returned wrong number of target files.", 2, results.size()); assertTrue("Targets do not contain class target.", results.contains(new File(basedir, base + ".class"))); assertTrue("Targets do not contain class target.", results.contains(new File(basedir, base + ".xml"))); } public void testShouldReturnNoTargetFilesWhenSourceFileHasWrongSuffix() throws InclusionScanException { String base = "path/to/file"; File basedir = new File("."); Set targets = new HashSet(); targets.add(".class"); targets.add(".xml"); SuffixMapping mapping = new SuffixMapping(".java", targets); Set results = mapping.getTargetFiles(basedir, base + ".apt"); assertTrue("Returned wrong number of target files.", results.isEmpty()); } }