Giter Site home page Giter Site logo

fest-reflect's People

Contributors

alexruiz avatar ihr avatar joel-costigliola avatar wanghy 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

fest-reflect's Issues

Status of 2.0

Hi!

I saw in the commit history that there are lot of great changes since the 1.4.1 version. Are you guys plan to release the 2.0 version? This project seems to be a little bit abandoned. :(

Nested field management with dot notation access

For the time being we access nested fields like this :

field("session").ofType(Session.class)
                .withinField("clientStatusDao").withinField("notificationService")
                .in(businessService)
                .set(sessionMock);

And I think it would be lighter/more elegant to be allowed to write :

field("notificationService.clientStatusDao.session").ofType(Session.class)
                                                    .in(businessService)
                                                    .set(sessionMock);

Improve documentation of Reflection.type() for classloader issues

I've been replacing calls to the java.util.reflect package with equivalent code from fest-reflect, and I had an issue with type("...").load(), which throws a ClassNotFoundException when Class.forName("...") did not.

I thought that type("...").load() was strictly equivalent to Class.forName("..."), minus the checked exceptions. In fact, it is not : Class.forName() uses ClassLoader.getCallerClassLoader to determine the class loader to use, while fest-reflect's Type.load() uses the classloader used to load itself.

In complex cases (maven + ant in my case), fest-reflect's jar is not loaded in the same class loader as the application classes, which causes the problem (and can be fixed with .withClassLoader(getClass().getClassLoader()) in the calling class).

A solution would be to use sun.reflect.Reflection.getCallerClass() to determine the right classloader, but it would add a dependency to a sun package (bad bad bad).

When JEP 176 is available, it should be possible to use this new mechanism to implement a reliable detection of the caller class loader.

In the meantime, the documentation should explicitly mention this classloading issue, as it can be tricky to debug.

master branch does not build

Hello

The command: mvn clean install on the latest branch master does not build

C:\Users\fandre\Documents\git\javacc\fest-reflect>C:\ASF\apache-maven-3.6.1\bin\mvn clean install -U
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< org.easytesting:fest-reflect >--------------------
[INFO] Building FEST-Reflect 2.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from mis-snapshots: http://private.neticoa.fr:50003/repository/mis-snapshots/org/easytesting/fest-util/1.3.0-SNAPSHOT/maven-metadata.xml
Downloading from sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/org/easytesting/fest-util/1.3.0-SNAPSHOT/maven-metadata.xml
Downloading from mis-snapshots: http://private.neticoa.fr:50003/repository/mis-snapshots/org/easytesting/fest-util/1.3.0-SNAPSHOT/fest-util-1.3.0-SNAPSHOT.pom
Downloading from sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/org/easytesting/fest-util/1.3.0-SNAPSHOT/fest-util-1.3.0-SNAPSHOT.pom
[WARNING] The POM for org.easytesting:fest-util:jar:1.3.0-SNAPSHOT is missing, no dependency information available
Downloading from releases: http://private.neticoa.fr:50003/repository/public/org/easytesting/fest-test/2.1.2/fest-test-2.1.2.pom
Downloading from mis-releases: http://private.neticoa.fr:50003/repository/mis-releases/org/easytesting/fest-test/2.1.2/fest-test-2.1.2.pom
Downloading from central: https://repo.maven.apache.org/maven2/org/easytesting/fest-test/2.1.2/fest-test-2.1.2.pom
[WARNING] The POM for org.easytesting:fest-test:jar:2.1.2 is missing, no dependency information available
Downloading from mis-snapshots: http://private.neticoa.fr:50003/repository/mis-snapshots/org/easytesting/fest-util/1.3.0-SNAPSHOT/fest-util-1.3.0-SNAPSHOT.jar
Downloading from sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/org/easytesting/fest-util/1.3.0-SNAPSHOT/fest-util-1.3.0-SNAPSHOT.jar
Downloading from releases: http://private.neticoa.fr:50003/repository/public/org/easytesting/fest-test/2.1.2/fest-test-2.1.2.jar
Downloading from mis-releases: http://private.neticoa.fr:50003/repository/mis-releases/org/easytesting/fest-test/2.1.2/fest-test-2.1.2.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/easytesting/fest-test/2.1.2/fest-test-2.1.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.049 s
[INFO] Finished at: 2020-02-04T10:21:25+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project fest-reflect: Could not resolve dependencies for project org.easytesting:fest-reflect:jar:2.0-SNAPSHOT: The following artifacts could not be resolved: org.easytesting:fest-util:jar:1.3.0-SNAPSHOT, org.easytesting:fest-test:jar:2.1.2: Could not find artifact org.easytesting:fest-util:jar:1.3.0-SNAPSHOT in mis-snapshots (http://private.neticoa.fr:50003/repository/mis-snapshots/) -> [Help 1]
[ERROR]

PropertySupport: Make methods accessible prior to invocation

Mapping list elements like so:

assertThat(collection).onProperty("id").containsExactly(...)

May result in an IllegalAccessException if the elements of the collection are package-local (or otherwise restricted). This can even be the case if the collection contains package-local implementations of a public interface, i.e. in situations where a programmatic invocation of the getter works.

Invoking method#setAccessible(true) prior to invocation of the property set/get methods would resolve such issues.

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.