Feed on
 Posts
 Comments
Java Beans dot Asia

Just a few simple tutorials …

This can be a hard one, since it requires from you to be familiar with Drools.

Consider the condition side of the following rules:

rule "object comparison one"
no-loop

when
	$customer1 : Customer( )
	$customer2 : Customer(this != $customer1)
then
	System.out.println("Rule one - Objects are equal");
end
rule "object comparison two"
no-loop

when
	$customer1 : Customer( )
	$customer2 : Customer(eval(this != $customer1))
then
	System.out.println("Rule two - Objects are equal");
end

Question(s):
Which of the two rules does valid comparison of the two Customer instances?
Which of the two rules is invalid? Why?

Looking forward for your answers dear readers

Resources:
Drools JBoss Rules 5.0 Developer’s Guide July 2009

GD Star Rating
loading...
Brainteaser Drools: Testing Objects, 9.5 out of 10 based on 2 ratings

Related posts:

  1. Drools – Working with Stateless Session
    Drools (now it is also called JBoss Rules) is an amazing open source framework which allows you to create business rules management system...
  2. Brainteaser: Broken Comparator
    Question: The following program returns result “1″, which indicates that first Integer value is greater than the second, why? import java.util.*; public class...
  3. Brainteaser: Broken Case of Inheritance
    Consider the following case of inheritance: public class ExtendingHashSet<E> extends HashSet<E> { private int counter = 0; public ExtendingHashSet() { } @Override public...
  4. Drools 5 Case Study 1- Writing DSL for DRL rule
    One of the blog readers, who posted a comment in my previous post Drools – tutorial on writing DSL template asked to me...
  5. Rule Engine Stress Testing
    I came across a blog by a company called Illation. What those guys do is compare performance of several rule engines available on...

Comments
  • Alexander Zagniotov August 23, 2009 at 11:03 am

    Brainteaser Drools: Testing Objects:
    This can be a hard one, since it requires from you to be familiar with Dr.. http://bit.ly/4wykv0

    GD Star Rating
    loading...