本文整理汇总了Java中org.kuali.rice.krad.util.BeanPropertyComparator.BeanComparisonException类的典型用法代码示例。如果您正苦于以下问题:Java BeanComparisonException类的具体用法?Java BeanComparisonException怎么用?Java BeanComparisonException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BeanComparisonException类属于org.kuali.rice.krad.util.BeanPropertyComparator包,在下文中一共展示了BeanComparisonException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCompare_unknownPropertyNames
import org.kuali.rice.krad.util.BeanPropertyComparator.BeanComparisonException; //导入依赖的package包/类
@Test
/**
* tests comparison with an unknown property name
*
* <p>test that a <code>NullPointerException</code> is thrown when the list of property names contains a property name
* that does not exist in the first argument to @{link org.kuali.rice.krad.util.BeanPropertyComparator#compare(java.lang.Object, java.lang.Object)}</p>
*/
public void testCompare_unknownPropertyNames() {
List unknownProperties = Arrays.asList(new String[] { "one", "two", "three" });
BeanPropertyComparator bpc = new BeanPropertyComparator(unknownProperties);
A a = new A("something", new Integer(0), Boolean.valueOf(false));
B b = new B("something else", new Integer(1), Boolean.valueOf(true));
boolean failedAsExpected = false;
try {
bpc.compare(a, b);
}
catch (BeanComparisonException e) {
if (e.getCause() instanceof NullPointerException) {
failedAsExpected = true;
}
}
Assert.assertTrue(failedAsExpected);
}
示例2: testCompare_unknownPropertyNames
import org.kuali.rice.krad.util.BeanPropertyComparator.BeanComparisonException; //导入依赖的package包/类
@Test
/**
* tests comparison with an unknown property name
*
* <p>test that a <code>NullPointerException</code> is thrown when the list of property names contains a property name
* that does not exist in the first argument to @{link org.kuali.rice.krad.util.BeanPropertyComparator#compare(java.lang.Object, java.lang.Object)}</p>
*/
public void testCompare_unknownPropertyNames() {
List unknownProperties = Arrays.asList(new String[] { "one", "two", "three" });
BeanPropertyComparator bpc = new BeanPropertyComparator(unknownProperties);
A a = new A("something", new Integer(0), Boolean.valueOf(false));
B b = new B("something else", new Integer(1), Boolean.valueOf(true));
// boolean failedAsExpected = false;
try {
// bpc.compare(a, b);
int lessThan = bpc.compare(a, b);
Assert.assertTrue(lessThan < 0);
}
catch (BeanComparisonException e) {
if (e.getCause() instanceof NullPointerException) {
// failedAsExpected = true;
throw new Error(e);
}
}
// Assert.assertTrue(failedAsExpected);
}
示例3: testCompare_privateProperty
import org.kuali.rice.krad.util.BeanPropertyComparator.BeanComparisonException; //导入依赖的package包/类
@Test
/**
* tests comparison when a property has a getter with private scope
*
* <p>test that a NullPointerException exception is thrown when the first argument to
* @{link org.kuali.rice.krad.util.BeanPropertyComparator#compare(java.lang.Object, java.lang.Object)}
* has a private scoped getter</p>
*/
public void testCompare_privateProperty() {
List privateProperty = Arrays.asList(new String[] { "s" });
BeanPropertyComparator bpc = new BeanPropertyComparator(privateProperty);
C c = new C("something else", 1, true);
A a = new A("something", new Integer(0), Boolean.valueOf(false));
// boolean failedAsExpected = false;
try {
// bpc.compare(c, a);
int lessThan = bpc.compare(c, a);
Assert.assertTrue(lessThan < 0);
}
catch (BeanComparisonException e) {
if (e.getCause() instanceof NullPointerException) {
throw new Error(e);
}
}
// Assert.assertTrue(failedAsExpected);
}
示例4: testCompare_privateProperty
import org.kuali.rice.krad.util.BeanPropertyComparator.BeanComparisonException; //导入依赖的package包/类
@Test
/**
* tests comparison when a property has a getter with private scope
*
* <p>test that a NullPointerException exception is thrown when the first argument to
* @{link org.kuali.rice.krad.util.BeanPropertyComparator#compare(java.lang.Object, java.lang.Object)}
* has a private scoped getter</p>
*/
public void testCompare_privateProperty() {
List privateProperty = Arrays.asList(new String[] { "s" });
BeanPropertyComparator bpc = new BeanPropertyComparator(privateProperty);
C c = new C("something else", 1, true);
A a = new A("something", new Integer(0), Boolean.valueOf(false));
boolean failedAsExpected = false;
try {
bpc.compare(c, a);
}
catch (BeanComparisonException e) {
if (e.getCause() instanceof NullPointerException) {
failedAsExpected = true;
}
}
Assert.assertTrue(failedAsExpected);
}