EMMA Coverage Report (generated Fri Jul 28 01:51:09 CEST 2006)
[all classes][org.jtiger.assertion]

COVERAGE SUMMARY FOR SOURCE FILE [Comparable.java]

nameclass, %method, %block, %line, %
Comparable.java100% (1/1)100% (3/3)100% (27/27)100% (10/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Comparable100% (1/1)100% (3/3)100% (27/27)100% (10/10)
Comparable (): void 100% (1/1)100% (3/3)100% (2/2)
assertEqualComparesToZero (ObjectFactory, Object []): void 100% (1/1)100% (12/12)100% (4/4)
assertNotEqualNotComparesToZero (ObjectFactory, Object []): void 100% (1/1)100% (12/12)100% (4/4)

1/*
2 * JTiger Unit Testing Framework for J2SE 1.5
3 * Copyright (C) 2005 Tony Morris
4 *
5 * This software is licenced under the
6 * Common Public Licence version 1.0
7 * http://www.opensource.org/licenses/cpl1.0.php
8 *
9 * You received a copy of this licence with this software.
10 */
11package org.jtiger.assertion;
12 
13import static org.jtiger.assertion.ComparableTesterFactory.newComparableTester;
14 
15/**
16 * Makes assertions on instances of
17 * <a href="%j2se.api.spec%/java/lang/Comparable.html">java.lang.Comparable</a>.
18 * This requires the creation of an instance of {@link ObjectFactory} to return instances to use to test.
19 * The given {@link ObjectFactory} must meet the its own general contract.
20 *
21 * @see ObjectFactory
22 * @see ObjectFactoryContract
23 * @see Comparable
24 * @author %javadoc.author.tag%
25 * @version %version%<br/>
26 *          <i>Build Number %build.number%</i><br/>
27 *          <i>Build Time %build.time% CET (GMT + 1)</i>
28 */
29public final class Comparable
30{
31    private Comparable()
32    {
33 
34    }
35 
36    /**
37     * Asserts that two equal instances of <tt>java.lang.Comparable</tt> return zero (0) from the <tt>compareTo</tt>
38     * method.
39     *
40     * @param factory The factory to use to return instances for making the assertion.
41     * @param message The assertion message.
42     * @throws AssertionException If the given <code>ObjectFactory</code> returns instances that are equal but do not
43     * return zero (0) from the <tt>compareTo</tt> method, or the compareTo method cannot be invoked through reflection.
44     */
45    public static void assertEqualComparesToZero(final ObjectFactory<? extends java.lang.Comparable<?>> factory, final Object... message) throws AssertionException
46    {
47        final ComparableTester tester = newComparableTester(factory);
48 
49        if(!tester.equalComparesToZero())
50        {
51            throw new AssertionException(message);
52        }
53    }
54 
55    /**
56     * Asserts that two unequal instances of <tt>java.lang.Comparable</tt> return non-zero from the <tt>compareTo</tt>
57     * method.
58     *
59     * @param factory The factory to use to return instances for making the assertion.
60     * @param message The assertion message.
61     * @throws AssertionException If the given <code>ObjectFactory</code> returns instances that are unequal and
62     * return zero (0) from the <tt>compareTo</tt> method, or the compareTo method cannot be invoked through reflection.
63     */
64    public static void assertNotEqualNotComparesToZero(final ObjectFactory<? extends java.lang.Comparable<?>> factory, final Object... message) throws AssertionException
65    {
66        final ComparableTester tester = newComparableTester(factory);
67 
68        if(!tester.notEqualNotComparesToZero())
69        {
70            throw new AssertionException(message);
71        }
72    }
73}

[all classes][org.jtiger.assertion]
EMMA 2.0.5312 (C) Vladimir Roubtsov