CPD Results

The following document contains the results of PMD's CPD 7.7.0.

Duplications

File Line
com\codebox\bean\JavaBeanTesterWorker.java 188
com\codebox\bean\JavaBeanTesterWorker.java 565
final PropertyDescriptor[] props = this.getProps(this.clazz);
        for (final PropertyDescriptor prop : props) {
            Method getter = prop.getReadMethod();
            final Method setter = prop.getWriteMethod();

            // Java Metro Bug Patch (Boolean Wrapper usage of 'is' possible
            if (getter == null && setter != null) {
                final String isBooleanWrapper = "is" + setter.getName().substring(3);
                try {
                    getter = this.clazz.getMethod(isBooleanWrapper);
                } catch (NoSuchMethodException | SecurityException e) {
                    // Do nothing
                }
            }

            if (getter != null && setter != null) {
                // We have both a get and set method for this property
                final Class<?> returnType = getter.getReturnType();
                final Class<?>[] params = setter.getParameterTypes();

                if (params.length == 1 && params[0] == returnType) {
                    // The set method has 1 argument, which is of the same type as the return type of the get method, so
                    // we can test this property
                    try {
                        // Build a value of the correct type to be passed to the set method
                        final Object value = this.buildValue(returnType, LoadType.STANDARD_DATA);
File Line
com\codebox\bean\JavaBeanTesterWorker.java 451
com\codebox\bean\JavaBeanTesterWorker.java 509
Assertions.assertNotEquals(ext, y,
                String.format(".equals() should not be equal for extension of type %s and empty object of type %s",
                        this.extension.getName(), this.clazz.getName()));
        Assertions.assertNotEquals(ext.hashCode(), y.hashCode(),
                String.format(".hashCode() should not be equal for extension of type %s and empty object of type %s",
                        this.extension.getName(), this.clazz.getName()));
        Assertions.assertNotEquals(ext.toString(), y.toString(),
                String.format(".toString() should not be equal for extension of type %s and empty object of type %s",
                        this.extension.getName(), this.clazz.getName()));