blob: 8bc61e5d4a55ace8474662bb9882922dcbf80be7 [file] [log] [blame]
/*
* 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.myfaces.buildtools.maven2.plugin.javascript.jmt;
import java.io.File;
import org.apache.maven.plugin.Mojo;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.codehaus.plexus.util.FileUtils;
public class StripDebugsMojoTest
extends AbstractMojoTestCase
{
public void testStripDebugs()
throws Exception
{
File target = new File( "target/test-target/strip-debugs" );
target.mkdirs();
FileUtils.cleanDirectory( target );
FileUtils.copyFileToDirectory( new File( "src/test/resources/with-debug/debugs.js" ),
target );
File testPom = new File( getBasedir(), "src/test/resources/strip-debugs.pom" );
Mojo mojo = (Mojo) lookupMojo( "compress", testPom );
assertNotNull( "Failed to configure the plugin", mojo );
mojo.execute();
File expected = new File( "./target/test-target/strip-debugs/debugs.js" );
assertTrue( "Expected the stripped file to have non-zero length.", expected.length() > 0 );
String source = FileUtils.fileRead( expected );
assertTrue( source.indexOf( "logger" ) < 0 );
}
}