Java Assertion

Main purpose of this library is to assert Object values with ease. It uses my Reflection library to access object value.

Code example:

final HashMap vals = new HashMap();
vals.put("f", "g");
vals.put("h", "1");
final ArrayList ars = new ArrayList();
ars.add("a");
ars.add("b");
o = new Object() {
        public final String a = "b";
        public final String b = "c";
        public final String c = "d";
        public final int d = 1;
        public final int e = 11;
        public final int f = 21;
        boolean yes = true;
        boolean no=false;
        public final HashMap g = vals;
        public final ArrayList h = ars;
};

Assertion.getInstance("a=b&&b=c&&c=d&&g.f=g&&g.h=1").satisfies(o);
Assertion.getInstance("d!=0&&e>10&&f

You can download the source code or binary from sourceforge. Binary contains reflection library.

  • Facebook
  • Twitter
  • Google
  • Google Plus
  • LinkedIn
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Comments are closed.