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:
parent
a3a296b0c2
commit
c8f509c041
@ -17,6 +17,7 @@ package org.apache.maven.dashboard.aggregator.clover;
|
|||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,6 +32,7 @@ public class CloverTPC
|
|||||||
double e = Double.valueOf( elements ).doubleValue();
|
double e = Double.valueOf( elements ).doubleValue();
|
||||||
double ce = Double.valueOf( coveredElements ).doubleValue();
|
double ce = Double.valueOf( coveredElements ).doubleValue();
|
||||||
DecimalFormat formatter = new DecimalFormat( "##%" );
|
DecimalFormat formatter = new DecimalFormat( "##%" );
|
||||||
|
|
||||||
return formatter.format( ce / e );
|
return formatter.format( ce / e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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) );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user