Skip to content

Commit eec459f

Browse files
committed
Add test for #52
1 parent d52fec9 commit eec459f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.fasterxml.jackson.module.mrbean;
2+
3+
import com.fasterxml.jackson.databind.*;
4+
5+
import java.io.IOException;
6+
7+
// test for [modules-base#52]
8+
public class TestDefaultMethods
9+
extends BaseTest {
10+
11+
public interface HasId {
12+
long id();
13+
}
14+
15+
public interface HasIdImpl extends HasId {
16+
@Override
17+
default long id() {
18+
return 42L;
19+
}
20+
}
21+
22+
public void testMaterializedDefaultMethod() throws IOException {
23+
final ObjectMapper mapper = newMrBeanMapper();
24+
25+
// Main thing is that we should not get an exception for missing method,
26+
// as it is correctly deduced to have been implemented
27+
final HasIdImpl bean = mapper.readValue("{}", HasIdImpl.class);
28+
assertEquals(42L, bean.id());
29+
}
30+
}

0 commit comments

Comments
 (0)