Author: bdube Date: Sat May 7 04:14:00 2011 New Revision: 1100441 URL: http://svn.apache.org/viewvc?rev=1100441&view=rev Log: Add test target and simple test class
Added: forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/src/test/ forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/src/test/org/ forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/src/test/org/apache/ forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/src/test/org/apache/forrest/ forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/src/test/org/apache/forrest/util/ forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/src/test/org/apache/forrest/util/ContentTypeTest.java (with props) Modified: forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/build.xml Modified: forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/build.xml URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/build.xml?rev=1100441&r1=1100440&r2=1100441&view=diff ============================================================================== --- forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/build.xml (original) +++ forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/build.xml Sat May 7 04:14:00 2011 @@ -25,6 +25,29 @@ <property name="bundle.symbolic.name" value="org.apache.forrest.util" /> <property name="bundle.bnd.file" location="util.bnd" /> + <target name="compile-tests"> + <javac srcdir="src/test" + destdir="build/classes" + debug="true" + includeantruntime="false"> + <compilerarg value="-Xlint" /> + <classpath> + <pathelement location="../lib/junit-4.8.1.jar" /> + </classpath> + </javac> + </target> + + <target name="test" depends="compile-tests"> + <java classname="org.junit.runner.JUnitCore" + fork="no"> + <classpath> + <pathelement location="../lib/junit-4.8.1.jar" /> + <pathelement location="build/classes" /> + </classpath> + <arg value="org.apache.forrest.util.ContentTypeTest" /> + </java> + </target> + <import file="../master.xml" /> </project> Added: forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/src/test/org/apache/forrest/util/ContentTypeTest.java URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/src/test/org/apache/forrest/util/ContentTypeTest.java?rev=1100441&view=auto ============================================================================== --- forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/src/test/org/apache/forrest/util/ContentTypeTest.java (added) +++ forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/src/test/org/apache/forrest/util/ContentTypeTest.java Sat May 7 04:14:00 2011 @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ +package org.apache.forrest.util; + +import static org.junit.Assert.*; +import org.junit.Test; + +import org.apache.forrest.util.ContentType; + +public class ContentTypeTest { + + @Test + public void getExtensionByName() { + String extension = ContentType.getExtensionByName("index.html"); + assertTrue("html".equals(extension)); + } + + @Test + public void getContentTypeByName() { + String contentType = ContentType.getContentTypeByName("index.html"); + assertTrue("text/html".equals(contentType)); + } + +} Propchange: forrest/trunk/whiteboard/forrest-osgi/org.apache.forrest.util/src/test/org/apache/forrest/util/ContentTypeTest.java ------------------------------------------------------------------------------ svn:eol-style = native