Add a simple test case. Source code formatting.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@373659 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl 2006-01-31 01:02:14 +00:00
parent a3a296b0c2
commit c8f509c041
2 changed files with 57 additions and 7 deletions

View File

@ -17,6 +17,7 @@ package org.apache.maven.dashboard.aggregator.clover;
* ====================================================================
*/
import java.text.DecimalFormat;
/**
@ -26,11 +27,12 @@ import java.text.DecimalFormat;
*/
public class CloverTPC
{
public static String computeTPC(String elements, String coveredElements)
public static String computeTPC( String elements, String coveredElements )
{
double e = Double.valueOf(elements).doubleValue();
double ce = Double.valueOf(coveredElements).doubleValue();
DecimalFormat formatter = new DecimalFormat("##%");
return formatter.format(ce/e);
double e = Double.valueOf( elements ).doubleValue();
double ce = Double.valueOf( coveredElements ).doubleValue();
DecimalFormat formatter = new DecimalFormat( "##%" );
return formatter.format( ce / e );
}
}

View File

@ -0,0 +1,48 @@
package org.apache.maven.dashboard.aggregator.clover;
/* ====================================================================
* Copyright 2006 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 junit.framework.TestCase;
/**
*/
public class CloverTPCTest extends TestCase
{
/**
* Constructor.
* @param name Name of the test.
*/
public CloverTPCTest( String name )
{
super( name );
}
/**
*/
public void testcomputeTPC() throws Exception
{
String elements = "100";
String coveredElements = "53";
assertEquals( "Clover TPC is '53%'",
"53%", CloverTPC.computeTPC( elements, coveredElements) );
}
}