Skip to content

Commit 10a6d08

Browse files
committed
feat(http): JsonMapper SAM in public package (no generic)
1 parent 6a0786d commit 10a6d08

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.retailsvc.http;
2+
3+
@FunctionalInterface
4+
public interface JsonMapper {
5+
Object mapFrom(byte[] body);
6+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.retailsvc.http;
2+
3+
import static org.assertj.core.api.Assertions.assertThat;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
class JsonMapperTest {
8+
@Test
9+
void usableAsLambda() {
10+
JsonMapper m = body -> new String(body);
11+
assertThat(m.mapFrom("hello".getBytes())).isEqualTo("hello");
12+
}
13+
}

0 commit comments

Comments
 (0)