Skip to content

Commit 92e61bb

Browse files
committed
Verify current behavior of non-public methods
1 parent c5176ab commit 92e61bb

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

mrbean/src/test/java/com/fasterxml/jackson/module/mrbean/TestAbstractClasses.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected Bean() { }
2424

2525
// also verify non-public methods
2626
protected abstract String getZ();
27-
private Object customMethod() { return new Object(); }
27+
private String customMethod() { return "Private methods rock!"; }
2828
}
2929

3030
/*
@@ -42,6 +42,6 @@ public void testSimpleInteface() throws Exception
4242
assertEquals(13, bean.y);
4343
assertEquals("Foo!", bean.getFoo());
4444
assertEquals("def", bean.getZ());
45-
assertNotNull(bean.customMethod());
45+
assertEquals("Private methods rock!", bean.customMethod());
4646
}
4747
}

mrbean/src/test/java/com/fasterxml/jackson/module/mrbean/TestAbstractClassesWithOverrides.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,18 @@ protected Bean() { }
2626

2727
// also verify non-public methods
2828
protected abstract String getZ();
29-
private Object customMethod() { return new Object(); }
29+
private Object customMethod() { return protectedAbstractMethod(); }
30+
protected abstract Object protectedAbstractMethod();
3031
}
3132

3233
public abstract static class CoffeeBean extends Bean {
3334
@Override public String roast(int temperature) {
3435
return "The coffee beans are roasting at " + temperature + " degrees now, yummy";
3536
}
37+
38+
@Override protected Object protectedAbstractMethod() {
39+
return "Private methods invoking protected abstract methods is the bomb!";
40+
}
3641
}
3742

3843
public abstract static class PeruvianCoffeeBean extends CoffeeBean {}
@@ -62,7 +67,7 @@ private void verifyBean(Bean bean) {
6267
assertEquals(13, bean.y);
6368
assertEquals("Foo!", bean.getFoo());
6469
assertEquals("def", bean.getZ());
65-
assertNotNull(bean.customMethod());
6670
assertEquals("The coffee beans are roasting at 123 degrees now, yummy", bean.roast(123));
71+
assertEquals("Private methods invoking protected abstract methods is the bomb!", bean.customMethod());
6772
}
6873
}

0 commit comments

Comments
 (0)