Examples of ClassData


Examples of net.sourceforge.cobertura.coveragedata.ClassData

public class ProjectDataDifferenceCalculatorTest extends Assert {

    void addSomeStuff(ProjectData data, String className,
            int numberOfLinesToTouch) {
        ClassData cd = data.getClassData(className);
        if (cd == null) {
            cd = new ClassData(className);
            data.addClassData(cd);
        }
        for (int i = 0; i < numberOfLinesToTouch; i++) {
            cd.touch(i, 1);
        }
    }
View Full Code Here

Examples of net.sourceforge.cobertura.coveragedata.ClassData

        }
    }

    void touchAJump(ProjectData data, String className, int lineNumber,
            boolean whichBranch) {
        ClassData cd = data.getClassData(className);
        cd.touchJump(lineNumber, 0, whichBranch, 1);
    }
View Full Code Here

Examples of net.sourceforge.cobertura.coveragedata.ClassData

    }

    ProjectData diffProjects(ProjectData larger, ProjectData smaller) {
        ProjectData result = new ProjectData();
        for (Object o : larger.getClasses()) {
            ClassData lcd = (ClassData) o;
            ClassData scd = (ClassData) smaller.getClassData(lcd.getName());
            result.addClassData(diffClasses(lcd, scd));
        }
        Set<String> largerNames = classNames(larger);
        Set<String> smallerNames = classNames(smaller);
        smallerNames.removeAll(largerNames);
View Full Code Here

Examples of net.sourceforge.cobertura.coveragedata.ClassData

        cd.touchJump(lineNumber, 0, whichBranch, 1);
    }

    void touchASwitch(ProjectData data, String className, int lineNumber,
            int switchNumber) {
        ClassData cd = data.getClassData(className);
        cd.touchSwitch(lineNumber, 0, switchNumber, 1);
    }
View Full Code Here

Examples of net.sourceforge.cobertura.coveragedata.ClassData

        ProjectDataDifferenceCalculator calc = new ProjectDataDifferenceCalculator(
                two, one);
        ProjectData diff = calc.getDifference();
        assertSame(calc.getLarger(), two);
        assertSame(calc.getSmaller(), one);
        ClassData foo = diff.getClassData("foo");
        assertEquals(3, foo.getLines().size());
        for (int i = 0; i < 2; i++) {
            LineData x = foo.getLineCoverage(i);
            assertEquals(x.getHits(), 1);
            assertEquals(x.hasBranch(), i == 1);
            if (x.hasBranch()) {
                JumpData jd = (JumpData) x.getConditionData(0);
                assertEquals(jd.getTrueHits(), 1);
                assertEquals(jd.getFalseHits(), 1);
            }
        }
        assertEquals(foo.getLineCoverage(2).getHits(), 0);
        ClassData bar = diff.getClassData("bar");
        assertEquals(3, bar.getLines().size());
        for (int i = 0; i < 3; i++) {
            LineData x = bar.getLineCoverage(i);
            assertEquals(x.getHits(), 0);
            assertEquals(x.hasBranch(), i == 2, "Switches for " + i);
            if (x.hasBranch()) {
                SwitchData sd = (SwitchData) x.getConditionData(0);
                assertEquals(1, sd.getDefaultHits());
                assertEquals(0, sd.getHits(0));
                assertEquals(0, sd.getHits(1));
                assertEquals(1, sd.getHits(2));

            }
        }
        ClassData baz = diff.getClassData("baz");
        assertEquals(8, baz.getLines().size());
        for (int i = 0; i < 8; i++) {
            LineData x = baz.getLineCoverage(i);
            assertEquals(x.getHits(), 1);
            assertFalse(x.hasBranch());
        }
        assertEquals(0, calc.errors.size());
        addSomeStuff(one, "baz", 2);
View Full Code Here

Examples of net.sourceforge.cobertura.coveragedata.ClassData

        buildKeyForLine();
    }

    void buildClassDataHelpers() {
        for (Object o : getData().getClasses()) {
            ClassData cd = (ClassData) o;
            ClassData dcd = null;
            if (getSamePackageData() != null) {
                dcd = (ClassData) getSamePackageData().getChild(
                        cd.getBaseName());
            }
            try {
View Full Code Here

Examples of net.sourceforge.cobertura.coveragedata.ClassData

public class PackageCoverageCalculatorTest extends Assert {

    void addSomeStuff(ProjectData data, String className,
            int numberOfLinesToTouch) {
        ClassData cd = data.getClassData(className);
        if (cd == null) {
            cd = new ClassData(className);
            data.addClassData(cd);
        }
        for (int i = 0; i < numberOfLinesToTouch; i++) {
            cd.touch(i, 1);
        }
    }
View Full Code Here

Examples of net.sourceforge.cobertura.coveragedata.ClassData

            public void instrument( String file, int line )
            {
              if ( isExcluded( file ) ) {
                getLogger().debug("ignoring " + file);
              } else {
                  ClassData classData = coverageProjectData.getOrCreateClassData( ApparatUtil.toClassname( file ) );
                  classData.setSourceFileName( getSourceFilePath( file ) );
                  classData.addLine( line, null, null );
              }
            }
        };
    }
View Full Code Here

Examples of org.fakereplace.client.ClassData

            if (file.isDirectory()) {
                handleClassesDirectory(base, file, classes);
            } else if (file.getName().endsWith(".class")) {
                final String relFile = file.getAbsolutePath().substring(base.getAbsolutePath().length() + 1);
                final String className = relFile.substring(0, relFile.length() - ".class".length()).replace("/", ".");
                classes.put(className, new ClassData(className, file.lastModified(), new ContentSource() {
                    @Override
                    public byte[] getData() throws IOException {
                        return Util.getBytesFromFile(file);
                    }
                }));
View Full Code Here

Examples of org.fakereplace.client.ClassData

                    String newName = nameReplacements.get(oldName);
                    nc.replaceClassName(oldName, newName);
                }
                nc.setName(o.getName());
                final byte[] data = nc.toBytecode();
                classes.put(o.getName(), new ClassData(o.getName(), new Date().getTime(), new ContentSource() {
                    @Override
                    public byte[] getData() throws IOException {
                        return data;
                    }
                }));
            }
            for (Class<?> o : addedClasses) {
                CtClass nc = pool.get(o.getName());

                if (nc.isFrozen()) {
                    nc.defrost();
                }

                for (String newName : nameReplacements.keySet()) {
                    String oldName = nameReplacements.get(newName);
                    nc.replaceClassName(newName, oldName);
                }
                final byte[] data = nc.toBytecode();
                classes.put(o.getName(), new ClassData(o.getName(), new Date().getTime(), new ContentSource() {
                    @Override
                    public byte[] getData() throws IOException {
                        return data;
                    }
                }));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.