Giter Site home page Giter Site logo

openpojo / openpojo Goto Github PK

View Code? Open in Web Editor NEW
154.0 19.0 41.0 162.89 MB

POJO Testing & Identity Management Made Trivial

Home Page: http://openpojo.com

License: Apache License 2.0

Java 99.72% Shell 0.28%
identity-management openpojo pojo-testing java getters setter coverage tostring equals hashcode

openpojo's Introduction

OpenPojo Build Status Coverage Status Maven Central

POJO Testing & Identity Management Made Trivial

Maven Group Plugin Latest Version
com.openpojo.openpojo 0.9.1

Testing Example

public class PojoTest {
  // Configured for expectation, so we know when a class gets added or removed.
  private static final int EXPECTED_CLASS_COUNT = 1;

  // The package to test
  private static final String POJO_PACKAGE = "com.openpojo.sample";

  @Test
  public void ensureExpectedPojoCount() {
    List <PojoClass> pojoClasses = PojoClassFactory.getPojoClasses(POJO_PACKAGE,
                                                                   new FilterPackageInfo());
    Affirm.affirmEquals("Classes added / removed?", EXPECTED_CLASS_COUNT, pojoClasses.size());
  }

  @Test
  public void testPojoStructureAndBehavior() {
    Validator validator = ValidatorBuilder.create()
                            // Add Rules to validate structure for POJO_PACKAGE
                            // See com.openpojo.validation.rule.impl for more ...
                            .with(new GetterMustExistRule())
                            .with(new SetterMustExistRule())
                            // Add Testers to validate behaviour for POJO_PACKAGE
                            // See com.openpojo.validation.test.impl for more ...
                            .with(new SetterTester())
                            .with(new GetterTester())
                            .build();

    validator.validate(POJO_PACKAGE, new FilterPackageInfo());
  }
}

Identity Management Example

public class Person {
  @BusinessKey(caseSensitive = false)  //Configure your field(s)
  private String lastName;

  @Override
  public boolean equals(Object obj) {
    return BusinessIdentity.areEqual(this, obj);
  }

  @Override
  public int hashCode() {
    return BusinessIdentity.getHashCode(this);
  }

  @Override
  public String toString() {
      return BusinessIdentity.toString(this);
  }
}

For more examples and the tutorials see the Wiki

openpojo's People

Contributors

ordtesters avatar oshoukry avatar shoukryo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openpojo's Issues

java.lang.SecurityException: Can not make a java.lang.Class constructor

private void allowAccessiblity() {
        accessibleObject.setAccessible(true);
    }

fails due to the JDK code:

    /* Check that you aren't exposing java.lang.Class.<init>. */
    private static void setAccessible0(AccessibleObject obj, boolean flag)
    throws SecurityException
    {
    if (obj instanceof Constructor && flag == true) {
        Constructor c = (Constructor)obj;
        if (c.getDeclaringClass() == Class.class) {
        throw new SecurityException("Can not make a java.lang.Class" +
                        " constructor accessible");
        }
    }
    obj.override = flag;
    }


java.lang.SecurityException: Can not make a java.lang.Class constructor 
accessible
    at java.lang.reflect.AccessibleObject.setAccessible0(AccessibleObject.java:118)
    at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:108)
    at com.openpojo.reflection.impl.PojoMethodImpl.allowAccessiblity(PojoMethodImpl.java:50)
    at com.openpojo.reflection.impl.PojoMethodImpl.<init>(PojoMethodImpl.java:46)
    at com.openpojo.reflection.impl.PojoMethodImpl.<init>(PojoMethodImpl.java:41)
    at com.openpojo.reflection.impl.PojoMethodFactory.getPojoMethods(PojoMethodFactory.java:49)
    at com.openpojo.reflection.impl.PojoMethodFactory.getMethod(PojoMethodFactory.java:70)
    at com.openpojo.reflection.impl.PojoMethodFactory.getFieldGetter(PojoMethodFactory.java:90)
    at com.openpojo.reflection.impl.PojoFieldImpl.<init>(PojoFieldImpl.java:46)
    at com.openpojo.reflection.impl.PojoFieldFactory.getPojoFields(PojoFieldFactory.java:43)
    at com.openpojo.reflection.impl.PojoClassFactory.getPojoClass(PojoClassFactory.java:46)
    at com.openpojo.random.RandomFactory.getRandomValue(RandomFactory.java:112)
    at com.openpojo.reflection.construct.InstanceFactory.createInstance(InstanceFactory.java:161)
    at com.openpojo.reflection.construct.InstanceFactory.getLeastCompleteInstance(InstanceFactory.java:107)
    at com.openpojo.random.RandomFactory.getRandomValue(RandomFactory.java:122)
    at com.openpojo.validation.test.impl.SetterTester.run(SetterTester.java:45)
    at com.openpojo.validation.PojoValidator.runValidation(PojoValidator.java:73)
    at com.edb.payment.pays.core.PojoTest.testPojoStructureAndBehavior(PojoTest.java:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


Original issue reported on code.google.com by [email protected] on 17 Oct 2010 at 7:27

Tests failed without TestNG

AffirmationFactory line 57
        return (Affirmation) loggerPojoClass.newInstance();

InvocationTargetException (class not found in static block in 
com.openpojo.validation.affirm.TestNGAssertAffirmation)

Original issue reported on code.google.com by [email protected] on 22 Jun 2010 at 5:42

"Package in not valid" Exception for non-existing package when calling PojoClassFactory.getPojoClassesRecursively

What steps will reproduce the problem?
1. Have a package name that as prefix has a package name that appears earlier 
in the package full name
Example: com.xxx.yyy.zzz and com.xxx.yyy.zzz.zzzconfig both exists.
2. Call PojoClassFactory.getPojoClassesRecursively(packageName, null);
Example: Above call with packageName set to com.xxx.yyy

What is the expected output? What do you see instead?
Expect to get a list of classes. Instead I get an expection
com.openpojo.reflection.exception.ReflectionException: Package 
[xxx.yyy.zzz.onfig] is not valid

What version of the product are you using? On what operating system?
Version: 0.4.2
OS: Windows Vista Enterprise (32 bits) SP 2

Please provide any additional information below.

The problem has been located to 
com.openpojo.reflection.java.packageloader.impl.JARPackageLoader
In the method getDirectSubPackageName is the following check:
        if (subPackageName.startsWith(packageName) && !packageName.equals(subPackageName))
This check means that incorrect matching of subpackages occur due to prefix of 
name matching. The if-clause need improvement.

Have run the same code on a Jenkins node, running Windows 7, and the problem 
does not occur?!?

Here is part of the innermost part of the stack trace when this situation occur:
Caused by: com.openpojo.reflection.exception.ReflectionException: Package 
[com.ericsson.tt.uecontrol.uehandler.onfig] is not valid
   com.openpojo.reflection.exception.ReflectionException.getInstance(ReflectionException.java:38)
        com.openpojo.reflection.impl.PojoPackageImpl.<init>(PojoPackageImpl.java:57)
        com.openpojo.reflection.impl.PojoPackageImpl.getPojoSubPackages(PojoPackageImpl.java:95)
        com.openpojo.reflection.service.impl.DefaultPojoClassLookupService.getPojoClassesRecursively(DefaultPojoClassLookupService.java:86)
        com.openpojo.reflection.impl.PojoClassFactory.getPojoClassesRecursively(PojoClassFactory.java:81)

Original issue reported on code.google.com by LHCper on 15 Jan 2013 at 8:55

NullPointer when Jenkins run tests

What steps will reproduce the problem?
1. Run test with Jenkins


What is the expected output? What do you see instead?
java.lang.NullPointerException: null
    at com.openpojo.reflection.java.packageloader.impl.FilePackageLoader.getTypes(FilePackageLoader.java:45)
    at com.openpojo.reflection.java.packageloader.Package.getTypes(Package.java:51)
    at com.openpojo.reflection.impl.PojoPackageImpl.getPojoClasses(PojoPackageImpl.java:82)
    at com.openpojo.reflection.service.impl.DefaultPojoClassLookupService.getPojoClasses(DefaultPojoClassLookupService.java:72)
    at com.openpojo.reflection.impl.PojoClassFactory.getPojoClasses(PojoClassFactory.java:65)

What version of the product are you using? On what operating system?
0.5.1

Please provide any additional information below.
No error with 0.5.0

Original issue reported on code.google.com by [email protected] on 31 Jul 2014 at 9:55

Rule and @Rule junit clashes

Using both com.openpojo.validation.rule.Rule from openpojo in a test and the 
@Rule provided by JUnit will cause clashes on the import.

If you want to use both in a test you are forced to use @org.junit.Rule

The @Rule is a very powerfull utility from JUnit and I expect it to gain a lot 
of interrest comming months and years.

A little refactor from Rule to e.g. PojoRule would come in handy.

Original issue reported on code.google.com by [email protected] on 24 Sep 2010 at 8:37

Is Pojo treatment as a type-only a correct assumption?

From amertum on "Why OpenPojo?" page - Dec 19th.

Wrote:

POJOs as JavaBeans? are not type at all. JavaBeans? is a specification for GUI 
form. They have Null Constructor because they model user form which can be 
empty, which required validation and event management.

The problem is in the 3-tier enterprise pattern Controller/Service/DataAccess? 
layer. Because it is not Object Oriented Programming (OOP). OOP is about data 
and logic tied together. 3-tier is about web services or procedural 
programming. Data EJBs got there and everything got mix up. POJOs were only 
used as DTO, and services to manipulate them and controller to put them on the 
web.

POJOs can hold business behavior IMHO as JavaBeans? were. I prefer 
Person.sendEmail(to) instead of emailService.sendEmail(from, to). Because 
Person hold the initial context from which create the email. But the emailing 
code should not be in Person class, we can pass a Emailer to the Person 
constructor.

Your @BusinessKey? for POJO identity is a good idea but I prefer apache commons 
equals builder or the guava equivalent because they do not rely on 
introspection.

The only thing I can see to use POJO without business code is CRUD only 
application.

Original issue reported on code.google.com by [email protected] on 17 Jan 2012 at 6:37

New Rule to detect shadow fields

I would like to suggest a new Rule.

When the source code is refactored and the hierarchy changed, we can come 
across an issue whereby both Super  class and SubClass define the same field.  
This is very likely to be a mistake and should be detected. Eg

Public class A {
 Private String myString;
// get and set
}

Public class B extends A {
Private String myString;
// get and set
}

A rule to detect this would be great! Note that the problem is not the 
getter/setter but the shadow field!

Thanks!
Benoit

Original issue reported on code.google.com by [email protected] on 25 Jul 2012 at 12:27

Field prefixes?

What about if fields have prefixes? e.g.

private String itsName;

public String getName() {...}
public void setName(String theName) {...}

Any chance this could be included? 

This is quite usual when corporate code standards are applied :-)


Original issue reported on code.google.com by [email protected] on 21 Jun 2010 at 2:21

stackoverflow businesskey on foreign keys

What steps will reproduce the problem?
1. have a parent child relation
2. add businesskey on foreign key and another
3. equals and hashcode using BusinessIdentity

What is the expected output? What do you see instead?
java.lang.StackOverflowError
    at java.util.regex.Pattern$5.isSatisfiedBy(Pattern.java:5151)
    at java.util.regex.Pattern$CharProperty.match(Pattern.java:3694)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4500)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4500)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4500)
    at java.util.regex.Pattern$BranchConn.match(Pattern.java:4466)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4615)
    at java.util.regex.Pattern$Curly.match0(Pattern.java:4177)
    at java.util.regex.Pattern$Curly.match(Pattern.java:4132)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4556)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4502)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4500)
    at java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
    at java.util.regex.Pattern$Start.match(Pattern.java:3408)
    at java.util.regex.Matcher.search(Matcher.java:1199)
    at java.util.regex.Matcher.find(Matcher.java:618)
    at java.util.Formatter.parse(Formatter.java:2517)
    at java.util.Formatter.format(Formatter.java:2469)
    at java.util.Formatter.format(Formatter.java:2423)
    at java.lang.String.format(String.java:2797)
    at com.openpojo.reflection.utils.ToStringHelper.nameValuePair(ToStringHelper.java:44)
    at com.openpojo.reflection.impl.PojoFieldImpl.toString(PojoFieldImpl.java:175)
    at com.openpojo.reflection.utils.ToStringHelper.PojoFieldsToString(ToStringHelper.java:76)
    at com.openpojo.reflection.utils.ToStringHelper.pojoClassToString(ToStringHelper.java:58)
    at com.openpojo.reflection.impl.PojoClassImpl.toString(PojoClassImpl.java:139)
    at com.openpojo.business.BusinessIdentity.toString(BusinessIdentity.java:77)
    at no.datametrix.smartguestjpa.entity.TSgRadcheckAttributes.toString(TSgRadcheckAttributes.java:191)
    at java.lang.String.valueOf(String.java:2854)
    at java.lang.StringBuilder.append(StringBuilder.java:128)
    at org.eclipse.persistence.internal.identitymaps.CacheKey.toString(CacheKey.java:512)
    at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2838)
    at java.util.Formatter$FormatSpecifier.print(Formatter.java:2718)
    at java.util.Formatter.format(Formatter.java:2488)
    at java.util.Formatter.format(Formatter.java:2423)
    at java.lang.String.format(String.java:2797)
    at com.openpojo.reflection.utils.ToStringHelper.nameValuePair(ToStringHelper.java:44)


What version of the product are you using? On what operating system?
Latest
apache tomee 1.6.0-SNAPSHOT
Ubuntu 12.04


Please provide any additional information below.
using eclipselink 2.5.0

Original issue reported on code.google.com by [email protected] on 16 Sep 2013 at 8:35

Invalid IdentityFactory state, no IdentityHandler found for object

What steps will reproduce the problem?
While Multi-Threading tests, threads run into missing IdentityHandler due to a 
race-condition updating the IdentityHandler list in IdentityFactory.

What is the expected output?
IdentityHandler is found and appropriate result returned.

What do you see instead?
com.openpojo.business.exception.BusinessException: Invalid IdentityFactory 
state, no IdentityHandler found for object 
[com.openpojo.reflection.java.packageloader.Package [@221e5f0: 
packageName=com.openpojo.utils.dummypackage.level2]]
    at com.openpojo.business.exception.BusinessException.getInstance(BusinessException.java:49)
    at com.openpojo.business.identity.IdentityFactory.getIdentityHandler(IdentityFactory.java:52)
    at com.openpojo.business.BusinessIdentity.getHashCode(BusinessIdentity.java:72)
    at com.openpojo.reflection.java.packageloader.Package.hashCode(Package.java:88)
    at java.util.HashMap.put(HashMap.java:372)
    at java.util.HashSet.add(HashSet.java:200)
    at com.openpojo.reflection.java.packageloader.Package.getSubPackages(Package.java:66)
    at com.openpojo.reflection.impl.PojoPackageImpl.getPojoSubPackages(PojoPackageImpl.java:94)
    at com.openpojo.reflection.service.impl.DefaultPojoClassLookupService.getPojoClassesRecursively(DefaultPojoClassLookupService.java:86)
    at com.openpojo.reflection.impl.PojoClassFactory.getPojoClassesRecursively(PojoClassFactory.java:81)
    at com.openpojo.reflection.impl.PojoClassFactoryTest.__CLR4_0_1exaliw2h6(PojoClassFactoryTest.java:118)
    at com.openpojo.reflection.impl.PojoClassFactoryTest.testGetPojoClassesRecursively(PojoClassFactoryTest.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:24)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)


Issue will be fixed in next release.

Original issue reported on code.google.com by [email protected] on 3 Sep 2014 at 10:20

Testing Java primitives

What steps will reproduce the problem?
1. Test class that has Java primitive types (e.g. boolean)
2. As described in Java POJO bean description (Sun Java Specification) in case 
that POJO has primitive 'boolean' then getters and setters should be named 
is{PROPERTY_NAME}() and setter is correct set{PROPERTY_NAME}.
3.Try to add:
        pojoValidator.addRule(new GetterMustExistRule());
        pojoValidator.addRule(new SetterMustExistRule());

4. PojoValidtor is complaining that there is no getter for this field

What version of the product are you using? On what operating system?

This issue doesn't depend on OS.


Please provide me information what is best usage scenario in this UC?

Thank you

Original issue reported on code.google.com by [email protected] on 30 Mar 2011 at 10:57

Failing to detect mixed primitive and object types.

What steps will reproduce the problem?
1. Create a pojo that has a private field that is Integer
2. Create getter that return native int.
3.  All tests pass fine

What is the expected output? What do you see instead?
- Expected the setter / getter to fail since auto boxing masks possible runtime 
null pointer failures.

Please use labels and text to provide additional information.
- Error applies to 0.3.10 and prior releases.

Original issue reported on code.google.com by [email protected] on 18 Jul 2012 at 5:12

Patch: getAnnotations method on PojoField

Enhancement: getAnnotations method on PojoField to return all annotations.

I wanted/needed a getAnnotations method for a field, so I've added one to 
PojoField, together with a test for the impl. Might also be nice to have for 
PojoClass and PojoMethod, but I didn't need those yet.

Patches attached. Hope you find it useful enough to include.

Original issue reported on code.google.com by [email protected] on 22 Sep 2010 at 1:35

Attachments:

Maven 2 dist?

Are there any plans to provide a maven2 repo or upload to central?

Original issue reported on code.google.com by [email protected] on 31 Aug 2010 at 11:49

Remove output to stdout

What steps will reproduce the problem?
1. Upgrade from openpojo 0.5.2 to openpojo 0.6.x
2. Run tests
3. In the console the following output is generated
Clover 3 not detected, ignoring
Clover 4 not detected, ignoring
Cobertura not detected, ignoring
Jacoco not detected, ignoring

What is the expected output? What do you see instead?
No output should be written to stdout

What version of the product are you using? On what operating system?
OpenPojo 0.6.2 (detected also in 0.6.0 and 0.6.1
Windows 7

Please provide any additional information below.
Appears when running JUnit test through maven or Eclipse where the POJO is 
tested with OpenPojo.

If for exxample Jacoco is added as a dependency to the project the following 
output is written to stdout:
Clover 3 not detected, ignoring
Clover 4 not detected, ignoring
Cobertura not detected, ignoring
Jacoco detected, auto-configuring OpenPojo to ignore its structures.


Original issue reported on code.google.com by [email protected] on 9 Jan 2015 at 12:17

Attachments:

PojoValidator fails on array fields

What steps will reproduce the problem?
1. Create a class with a BLOB byte[] field, such as this one:
        import javax.persistence.Lob;

        public class PojoLine {
                @Lob
                private byte[] picture;

                public byte[] getPicture() {
                        return picture.clone();
                }

                public void setPicture(byte[] picture) {
                        this.picture = picture.clone();
                }
        }
2. Test with the PojoValidator with a GetterTester and/or SetterTester (happens 
with both)


What is the expected output? What do you see instead?
My test should pass. Instead, PojoValidator says "Getter returned non equal 
value for field=[...picture...]"
Obviously this happens because of the clones. But I think these are necessary 
to defend against external mutations.

What version of the product are you using? On what operating system?
Version 0.4.9

Please provide any additional information below.
* With java.util.Date, PojoValidator doesn't mind if I clone them.
* I've dug around a bit in the code, and it looks like Assert.assertEquals is 
used, also for arrays, where Assert.assertArrayEquals would be preferable.
* OpenPojo is awesome! I discovered it last week and I love it already.

Original issue reported on code.google.com by [email protected] on 20 Feb 2014 at 3:32

Issue 27 fix creates a new bug - missing getter issue, even if the getter exists

What steps will reproduce the problem?
1. Create a hierarchy of pojos, one interface - Truck declaring a Getter of an 
interface Wheel
2. Create Implementations, DirtTruck and implement this getter - returning type 
of a Wheel implementation, e.g. AlluminiumWheel. Getter has to actually be 
declared to return AlluminiumWheel - not the interface Wheel
3. execute GetterMustExist test on this pojo hierarchy

What is the expected output? What do you see instead?
Field is missing getter is returned
Field does have a getter is expected

What version of the product are you using? On what operating system?
0.4.2

Please provide any additional information below.
This issue fix created a new issue:
http://code.google.com/p/openpojo/source/detail?r=581#

This line is a problem:
if (pojoMethod.getReturnType().equals(field.getType())) {

it should check assignability not equality of types.

Original issue reported on code.google.com by [email protected] on 15 Nov 2012 at 1:39

getter and setter naming conventions wrong

1. create attribute String eMail
2. create getter and setter methods "geteMail" and "seteMail"

expected output is OK but the SetterMustExists and GetterMustExists return 
AssertionError.


Version 0.3.7, MacOSX

See:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=154823

Original issue reported on code.google.com by [email protected] on 18 Nov 2011 at 12:22

Exception for illegal character in path when having space in path (PojoClassFactory.getPojoClassesRecursively)

What steps will reproduce the problem?
1. Create a directory on Windows with one or more spaces in its namn.
2. Create a file that calls 
PojoClassFactory.getPojoClassesRecursively(packageName, null) with the package 
the same as the class. The file should be in a directory with a path containing 
a space. (Example file included: TriggerUriExceptionTest.java)
3. Run this first as a stand alone java program, as a test program in TestNG 
started from Maven and then using the exec-maven-plugin to execute it as a 
stand alone test program.

What is the expected output? What do you see instead?
It should be the same result in all cases but get an exception about "Illegal 
character in path" indicating problems to create URI in the exec-maven-plugin 
case. It is not clear that it is an Openpojo problem but the exception trace 
(see err) indicate that it might be.

What version of the product are you using? On what operating system?
Openpojo 0.4.3
exec-maven-plugin 1.1
Java 1.7.0_25
Apache Maven 3.0.5
Windows 7

Please provide any additional information below.

The same Maven execution was performed on a directory path that did not contain 
any spaces in its name and the problem did not occur.
This means that I have a workaround I could use.

Original issue reported on code.google.com by LHCper on 4 Sep 2013 at 2:54

Attachments:

RuleViolationException should be able to carry more information.

RuleValidationException does not permit additional information to be
captured when constructing the exception. This would be very useful for
cases where rules are parameterised: the exception can carry the exact
parameter information that cuased the rule violation rather than having to
step through (potentially many) test POJOs in a debugger to discover
exactly which POJO class failed its validation.

Original issue reported on code.google.com by [email protected] on 27 May 2010 at 10:07

Add support for Immutable.

Need a rule to test immutability of an objects

Ideally every object deemed immutable has the following criteria:
1. All Fields are final.
2. Setters return a new copy of the object not update any setting on existing 
object.
3. Getters don't return modifiable references (i.e. return a clone or immutable 
objects).

Thank you Kajetan for this request.


Original issue reported on code.google.com by [email protected] on 1 Oct 2012 at 6:39

it will fail if parameter of setter is an abstract class

What steps will reproduce the problem?

Test a setter and the parameter is an abstract class.

What is the expected output? What do you see instead?

can't generate instance for Abstract class.

What version of the product are you using? On what operating system?

0.4.2 Windows

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 13 Dec 2012 at 1:36

How can I declare derived/calculated fields - ones which only have getters and not setters ?

I have some pojos which set/get 4 datetime fields - and we also have related 
fields *and* getters (not setters) which covert those date times into local 
time zone date times. Can this be supported ?

e.g.

private Date startSate; // with getter and setter - setter also coverts and 
sets startLocalDate
private LocalDateTime startLocalDate; // with just setter

Original issue reported on code.google.com by [email protected] on 7 Oct 2014 at 4:18

A Rule to test the Equality Contract

As defined on
http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Obj
ect),
the rule should test that the POJO correctly implements the equals contract.

This may or may not be associated with @BusinessKey annotations in the pojo
- preferably not so that this rule can be tested with any pojo
implementation of equals() and hashCode().


Original issue reported on code.google.com by [email protected] on 28 May 2010 at 11:25

NullPointerException during testing in junit and maven

What steps will reproduce the problem?
1. Run junit test with my pojos
2.
3.

What is the expected output? What do you see instead?
Expect:Pass
Failed with NullPointerException

What version of the product are you using? On what operating system?
Windows 7  Maven 3.3 validating with 
        pojoValidator.addRule(new NoStaticExceptFinalRule());
        pojoValidator.addRule(new SetterMustExistRule());
        pojoValidator.addRule(new NoPublicFieldsRule());
        pojoValidator.addTester(new DefaultValuesNullTester());
        pojoValidator.addTester(new SetterTester());
        pojoValidator.addTester(new GetterTester());

Please provide any additional information below.
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.078 sec <<< FA
ILURE!
testPojoStructureAndBehavior(ca.cppib.ibor.data.PojoTest)  Time elapsed: 0.016 s
ec  <<< ERROR!
java.lang.NullPointerException
        at com.openpojo.reflection.construct.InstanceFactory.createInstance(Inst
anceFactory.java:201)
        at com.openpojo.reflection.construct.InstanceFactory.getLeastCompleteIns
tance(InstanceFactory.java:149)
        at com.openpojo.validation.utils.ValidationHelper.getBasicInstance(Valid
ationHelper.java:56)
        at com.openpojo.validation.test.impl.DefaultValuesNullTester.run(Default
ValuesNullTester.java:35)
        at com.openpojo.validation.PojoValidator.runValidation(PojoValidator.jav
a:74)
        at ca.cppib.ibor.data.PojoTest.testPojoStructureAndBehavior(PojoTest.jav
a:84)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Framework
Method.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCal
lable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMe
thod.java:44)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMet
hod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.
java:26)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRun
ner.java:70)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRun
ner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provide
r.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4
Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider
.java:112)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(
ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke
(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(Provi
derFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(Fork
edBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:
75)

Original issue reported on code.google.com by [email protected] on 3 Oct 2014 at 9:18

Bug in equals

The following stacktrace shows the error.
It's not a requirement that the target object uses openpojo.
Haven't checked into the actual code.

com.openpojo.business.exception.BusinessException: No business Keys defined on 
class=[class com.edb.finance.common.spring.shortcircuit.State]
        at com.openpojo.business.exception.BusinessException.<init>(BusinessException.java:32) ~[openpojo-0.3.5.jar:na]
        at com.openpojo.business.exception.BusinessException.getInstance(BusinessException.java:48) ~[openpojo-0.3.5.jar:na]
        at com.openpojo.business.identity.impl.DefaultBusinessValidator.validate(DefaultBusinessValidator.java:48) ~[openpojo-0.3.5.jar:na]
        at com.openpojo.business.identity.impl.DefaultIdentityHandler.validate(DefaultIdentityHandler.java:45) ~[openpojo-0.3.5.jar:na]
        at com.openpojo.business.BusinessIdentity.areEqual(BusinessIdentity.java:55) ~[openpojo-0.3.5.jar:na]
        at com.edb.payment.pays.core.model.payment.DueDatePayment.equals(DueDatePayment.java:435) ~[pays-core-model-3.0-20110818.142809-252.jar:3.0-SNAPSHOT]
        at java.util.WeakHashMap.isEqual(WeakHashMap.java:737) ~[na:na]
        at java.util.WeakHashMap.put(WeakHashMap.java:612) ~[na:na]
        at org.apache.commons.lang3.builder.ToStringStyle.register(ToStringStyle.java:182) ~[commons-lang3-3.0.1.jar:3.0.1]
        at org.apache.commons.lang3.builder.ToStringStyle.appendClassName(ToStringStyle.java:1444) ~[commons-lang3-3.0.1.jar:3.0.1]
        at org.apache.commons.lang3.builder.ToStringStyle.appendStart(ToStringStyle.java:369) ~[commons-lang3-3.0.1.jar:3.0.1]
        at org.apache.commons.lang3.builder.ToStringBuilder.<init>(ToStringBuilder.java:263) ~[commons-lang3-3.0.1.jar:3.0.1]
        at org.apache.commons.lang3.builder.ReflectionToStringBuilder.<init>(ReflectionToStringBuilder.java:462) ~[commons-lang3-3.0.1.jar:3.0.1]
        at org.apache.commons.lang3.builder.ReflectionToStringBuilder.toString(ReflectionToStringBuilder.java:288) ~[commons-lang3-3.0.1.jar:3.0.1]
        at org.apache.commons.lang3.builder.ReflectionToStringBuilder.toString(ReflectionToStringBuilder.java:119) ~[commons-lang3-3.0.1.jar:3.0.1]
        at 

Original issue reported on code.google.com by [email protected] on 21 Aug 2011 at 7:31

Filter non concrete seems to do the inverse of advertised

What steps will reproduce the problem?

1. Use FilterNonConcrete to filter out non concrete classes

What is the expected output? What do you see instead?

A list of classes excluding all non concrete classes. But what i see instead is 
a list of interfaces, enums and non concrete classes. 

What version of the product are you using? On what operating system?

Version 0.0.4 released through maven on MacOS X 10.6.

---------------------

Please provide any additional information below.

Code from FilterNonConcrete class:

    public boolean include(final PojoClass pojoClass) {
        return !pojoClass.isConcrete() && (nextFilter == null || nextFilter.include(pojoClass));
    }

As you can see it does not include the concrete classes, but excludes them, 
which is the inverse of what is mentioned in the javadoc (which contains a 
small typo btw)

Thanks in advance for correcting this small mistake,
David

Original issue reported on code.google.com by [email protected] on 15 Oct 2010 at 10:18

FilterNonConcrete not working properly.

I have this filterchain:
        PojoClassFilter pojoClassFilter = new FilterChain( new FilterEnum(), 
                                                           new FilterPackageInfo(), 
                                                           new FilterNonConcrete() );



This pojo:

public abstract class AbstractAgreementProposal
    extends AbstractVo
{

    private static final long serialVersionUID = 8731822437600937681L;

}



1. it shouldn't be picked up
2. it would be nice if openpojo could ignore the special private static final 
member serialVersionUID as it specified by the java language itself. Maybe a 
SerializableRule could be made that checks that serialVersionUID in fact is 
declared in a Serializable bean?

Original issue reported on code.google.com by [email protected] on 16 Feb 2011 at 2:23

Warning of rejection of "outboxable" types

What steps will reproduce the problem?
1. Have a class with a field of a primitive type, e.g. long
2. Have a getter for the field using the corresponding object type, e.g. Long
3. Call PojoClassFactory.getPojoClassesRecursively(packageName, null)

What is the expected output? What do you see instead?
Expect to see no warnings in the logs.
Does get several "WARN  c.o.r.impl.PojoMethodFactory - Getter=[getTimeoutMs] in 
class=[com.something.Timeout] rejected due non-euqal return types [long != 
class java.lang.Long]

What version of the product are you using? On what operating system?
openpojo-0.4.3 on Windows 7

Please provide any additional information below.
The output is made on line 96, in file PojoMethodFactory.class, in the 
getFieldGetter. On line 93 the following code line is used:
  pojoMethod.getReturnType().equals(field.getType()
Of course, long and Long are not equal. But maybe one could use 
isAssignableFrom (or instanceof) to allow for "outboxing" of fields?
BTW, the warning is misspelled: "euqal".

Original issue reported on code.google.com by LHCper on 27 Jan 2014 at 3:54

EnumRandomGenerator use == instead of equals


com.openpojo.random.dynamic.EnumRandomGenerator 

        PojoMethod valuesPojoMethod = null;
        for (PojoMethod pojoMethod : pojoClass.getPojoMethods()) {
            if ("values".equals(pojoMethod.getName()) {
                valuesPojoMethod = pojoMethod;
                break;
            }
        }

Original issue reported on code.google.com by [email protected] on 29 Apr 2011 at 9:44

Javadocs and source missing from distribution

What version of the product are you using? On what operating system?
OpenPojo-build-20100322-1632/Linux

Would be nice if the javadocs and source were bundled in the distribution
zipfile. (Source is less important since one could just fetch from the
repository, but javadoc would be very helpful as it can be integrated with
most good IDEs, and is especially important when just getting started.)

Original issue reported on code.google.com by [email protected] on 27 Mar 2010 at 8:38

pojoclass validation fails when getting the java code coverage from cobertura

What steps will reproduce the problem?

run openpojo validation on pojo classes with the maven goal:

mvn cobertura:cobertura

What is the expected output? What do you see instead?

The tests fail when running the cobertura plugin with: java.lang.AssertionError



What version of the product are you using? On what operating system?
0.4.9, reproduced on windows and unix

Please provide any additional information below.


This is the same issue as number 29, but instead of Jacoco it applies to 
cobertura.

java.lang.AssertionError: Public fields=[PojoFieldImpl [field=public static 
final transient int[] com.mycompany.MyClass.__cobertura_counters, 
fieldGetter=null, fieldSetter=null]] not allowed
    at org.junit.Assert.fail(Assert.java:88)
    at com.openpojo.validation.affirm.JUnitAssertAffirmation.fail(JUnitAssertAffirmation.java:42)
    at com.openpojo.validation.affirm.Affirm.fail(Affirm.java:46)
    at com.openpojo.validation.rule.impl.NoPublicFieldsRule.evaluate(NoPublicFieldsRule.java:35)
    at com.openpojo.validation.PojoValidator.runValidation(PojoValidator.java:66)


Original issue reported on code.google.com by [email protected] on 13 Feb 2014 at 11:25

pojoclass validation fails when getting the java code coverage data with tools such as EclEmma

at first ,I used junit to validate and test the pojoclasses ,it all went right. 
But once I wanted to get the code coverage report, unit tests  failed with the 
following stacktrace:

java.lang.AssertionError: Static fields=[PojoFieldImpl [field=private static 
transient boolean[] com.branchitech.tasktop.domain.LastModifier.$jacocoData, 
fieldGetter=null, fieldSetter=null]] not marked final are not allowed
    at org.junit.Assert.fail(Assert.java:93)
    at com.openpojo.validation.affirm.JUnitAssertAffirmation.fail(JUnitAssertAffirmation.java:41)
    at com.openpojo.validation.affirm.Affirm.fail(Affirm.java:43)
    at com.openpojo.validation.rule.impl.NoStaticExceptFinalRule.evaluate(NoStaticExceptFinalRule.java:37)
    at com.openpojo.validation.PojoValidator.runValidation(PojoValidator.java:65)
    at com.branchitech.tasktop.domain.PojoJVM6Test.pojoTest(PojoJVM6Test.java:182)

we can get some information:
the pojoclass dismatch the Rule of NoStaticExceptFinalRule, because the test 
class LastModidier.class has a field named of $jacocoData ,which Type is 
private static transient boolean[] , this field was added to record execution 
coverage data.

So how can we get the code coverage report with openpojo?




Original issue reported on code.google.com by [email protected] on 31 Jul 2012 at 6:10

Classpath containing spaces results in NPE in PackageHelper.getClasses

What steps will reproduce the problem?
1. Create a test in a project with spaces in the classpath (ex. E:\My Test 
Project\classes\org\organization\project\package)
2. In your test setup include the line: pojoClasses = 
PojoClassFactory.getPojoClasses( POJO_PACKAGE, new FilterPackageInfo() );
3. In a test, do this:      for( PojoClass pojoClass : pojoClasses )
        {
            pojoValidator.runValidation( pojoClass );
        }


What is the expected output? What do you see instead?
Expect to learn that my tests failed because I'm a lousy programmer. What 
happened instead is I get a NullPointerException resulting from how this line 
of code behaves: File directory = getPackageAsDirectory(packageName);

In my example, directory contains the following: 
"E:\My%20Test%20Project\classes\org\organization\project\package

The immediately following call to directory.listFiles() returns null.


What version of the product are you using? On what operating system?
OpenPojo-build-20100803-1641
Windows XP



Please provide any additional information below.
My test class is a very slightly modified version of your example program. Only 
POJO_PACKAGE has been changed.

Here's the stack trace:

java.lang.NullPointerException
    at com.openpojo.reflection.utils.PackageHelper.getClasses(PackageHelper.java:48)
    at com.openpojo.reflection.impl.PojoPackageImpl.getPojoClasses(PojoPackageImpl.java:49)
    at com.openpojo.reflection.impl.PojoClassFactory.getPojoClasses(PojoClassFactory.java:76)
    at com.blackandwhitesoftware.campscheduler.model.PojoTest.setup(PojoTest.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Original issue reported on code.google.com by [email protected] on 28 Aug 2010 at 2:33

package-info.java is not a class

openpojo seems to think that package-info.java is a class. This causes a
reflection exception.

com.openpojo.reflection.exception.ReflectionException: This PojoClass is an
interface/abstract, can't create new instance
    at
com.openpojo.reflection.exception.ReflectionException.getInstance(ReflectionExce
ption.java:29)
    at
com.openpojo.reflection.impl.PojoClassImpl.validateBeforeNewInstance(PojoClassIm
pl.java:90)
    at
com.openpojo.reflection.impl.PojoClassImpl.newInstance(PojoClassImpl.java:130)
    at
com.openpojo.validation.rule.impl.DefaultValuesNullRule.evaluate(DefaultValuesNu
llRule.java:35)
    at com.openpojo.validation.PojoValidator.runValidation(PojoValidator.java:62)
    at
be.kzen.wenz.contractbeheer.core.ModelPojoTest.testPojoStructureAndBehavior(Mode
lPojoTest.java:64)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java
:44)
    at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
15)
    at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:4
1)
    at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20
)
    at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76
)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50
)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReferen
ce.java:46)
    at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:467)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:683)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java
:390)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.jav
a:197)


Original issue reported on code.google.com by [email protected] on 27 May 2010 at 8:03

Adding support for inherited PojoFields similar to PojoClass.getPojoFields()?

From Luke on wiki FAQ page - Dec 8th:

Is there any support for inheritance?

'PojoFieldFactory?.getPojoFields()' uses 'Class.getDeclaredFields()' , which 
does not include inherited fields, which would be nice to have when testing 
equals/hashCode and even toString in some cases...

Is there any plans for something along the lines of apache commons 
'EqualsBuilder?.appendSuper()' etc?

Original issue reported on code.google.com by [email protected] on 17 Jan 2012 at 6:18

RandomFactory should support generics on collections

Osman and I have talked about this but I wanted to add it as a formal request 
for enhancement.

Given an object like this:

class Container {
    List<Item> list;
}

Currently RandomFactory recognizes "list" as a List, but it doesn't pay 
attention to the type of objectcs the list stores, and generates a List with 
numbers in it instead of generating instances of Item.

Since RandomFactory already knows how to create instances of Item, it would be 
nice if it could detect the generic type and create the objects for the list.

There are definitely complications, for example what if we have 
List<Item<X<Y>>>, etc.  But in many simple cases RandomFactory could start to 
behave smarter while those complications are saved for a later release.

Alternative -

If we want OpenPojo to remain clean until these complications can be solved 
100%, there is another way to approach this which would allow users to 
implement a new kind of generator, buying some time until OpenPojo supports 
this fully.

For example in addition to RandomGenerator, we could add another kind of 
generator like this:

interface RandomFieldGenerator {
    // same as RandomGenerator
    public Collection<Class<?>> getTypes();

    // similar to RandomGenerator but with a Field parameter
    public Object doGenerate(Class<?> type, @Nullable java.lang.reflect.Field field);
}

The field would be null for a top-level class or if the field is not available 
for some reason.

With this type of approach I would be able to register a generator on 
List.class and populate it with the correct type gleaned from 
field.getGenericType() etc.

Original issue reported on code.google.com by [email protected] on 26 Sep 2014 at 4:37

Add the ability to construct objects that use generic parameters

What steps will reproduce the problem?

If a class is defined with constructor that takes generic list (i.e. MyClass { 
public MyClass(List<SomeOtherClass> list) }
OpenPojo does not respect the generic defined type in the parameter.

What is the expected output? What do you see instead?

Introspect the parameter of the constructor and send in the correctly 
constructed parameterized type.

Original issue reported on code.google.com by [email protected] on 16 Nov 2014 at 10:26

Issue running on Java 5

What steps will reproduce the problem?
1. Run OpenPojo on java 5

What is the expected output? What do you see instead?

Expect test to run successfully.
Instead test fails with the following stack trace:

java.lang.ExceptionInInitializerError
    at com.openpojo.log.LoggerFactory.getAndCacheLogger(LoggerFactory.java:73)
    at com.openpojo.log.LoggerFactory.getLogger(LoggerFactory.java:47)
    at com.openpojo.validation.PojoValidator.<init>(PojoValidator.java:33)
    at com.im.test.openpojo.helper.OpenPojoHelper.getPojoValidator(OpenPojoHelper.java:36)
    at com.im.test.openpojo.CommonPcamPojoTest.setup(CommonPcamPojoTest.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.openpojo.reflection.exception.ReflectionException: Unable to 
find suitable implementation among [[com.openpojo.log.impl.SLF4JLogger, 
com.openpojo.log.impl.Log4JLogger, com.openpojo.log.impl.JavaLogger]]
    at com.openpojo.reflection.exception.ReflectionException.getInstance(ReflectionException.java:38)
    at com.openpojo.reflection.facade.FacadeFactory.getLoadedFacadePojoClass(FacadeFactory.java:49)
    at com.openpojo.log.utils.ActiveLogger.autoDetect(ActiveLogger.java:76)
    at com.openpojo.log.utils.ActiveLogger.<clinit>(ActiveLogger.java:42)
    ... 28 more

It's not finding the logger itself that is the problem, there is a problem in 
ServiceRegistrar.initializeRandomGeneratorService() running on Java 5 as it 
calls:

// Queue
newRandomGeneratorService.registerRandomGenerator(QueueConcreteRandomGenerator.g
etInstance());

With the types for Queue, it includes:
java.util.ArrayDeque added in Java 6

What version of the product are you using? On what operating system?
0.4.2 on Windows

Please provide any additional information below.
We plan to upgrade soon to Java 6 but just from the Testing Tutorial:

Requirements¶
1.Java 5 or above. 
2.Optional 
1.JUnit 4.8.2+, Or TestNG 5.14.2+, if neither is present, an AssertionError 
will be thrown when a test fails. 
2.SLF4J, or Log4j, if neither is present, Java's Logging will be utilized 
instead. 

Assume that Java 5 ok to run it on. 

Original issue reported on code.google.com by [email protected] on 6 Feb 2013 at 5:04

JPA entity testing problem with default constructors

JPA requires a default, no-args constructor to be present for instantiation of 
classes.

Coupled with BusinessKey/BusinessIdentity testing this throws up some issues as 
for the automated testing the constructor with the least (none) arguments is 
selected.

If, as is the case with our code, the no-args constructors are there purely for 
compliance and are non-public to avoid non-framework instantiation, they're 
still picked up by the 'getLeastCompleteInstance' logic which will then lead to 
incomplete objects being created for testing and as a result unit test failures.

Some form of exclusion mechanism needs to be put in place - exclude non 
public/protected constructors from the 'getLeastCompleteInstance'; adding an 
annotation to exclude constructor for example.

Original issue reported on code.google.com by [email protected] on 21 Jun 2012 at 10:10

Error starting OpenPojo on Jdk 1.5


User reported:

Although The document say that require Java 5 or above, and the compiler target 
is 1.5 in pom.xml.

But the program use java.util.NavigableSet?, which seems comming with Java 6? 
So the program will throw NoClassDefFoundError? on Java 5 runtime.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
- OpenPojo-0.3.6


Original issue reported on code.google.com by [email protected] on 10 Oct 2011 at 4:35

doesn't support specific field name pattern

What steps will reproduce the problem?
Me: If field name likes this - nAbc, getter/setter would be getNAbc/setNAbc

What is the expected output? What do you see instead?
Me: should also identify out it has getter and setter instead of Null, :)

What version of the product are you using? On what operating system?
Me: 0.4.2

Please provide any additional information below.
Window7, eclipse3.5.2

Original issue reported on code.google.com by [email protected] on 11 Dec 2012 at 6:05

getter validation didn't allow isX() getter for a boolean - why ?

What steps will reproduce the problem?
1.Configured getter validation - but error didn't allow a boolean field to have 
getter of isX() format
2.
3.

What is the expected output? What do you see instead?
Allow getter of format isX()

What version of the product are you using? On what operating system?
            <groupId>com.googlecode.openpojo</groupId>
            <artifactId>openpojo</artifactId>
            <version>0.4.9</version>
            <scope>test</scope>

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 3 Oct 2014 at 9:23

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.