| 1 |
package com.fasterxml.jackson.dataformat.smile; |
| 2 |
|
| 3 |
import com.fasterxml.jackson.databind.*; |
| 4 |
|
| 5 |
import com.fasterxml.jackson.dataformat.smile.SmileFactory; |
| 6 |
|
| 7 |
public class TestFeatures |
| 8 |
extends SmileTestBase |
| 9 |
{ |
| 10 |
/* |
| 11 |
/********************************************************** |
| 12 |
/* Helper types |
| 13 |
/********************************************************** |
| 14 |
*/ |
| 15 |
|
| 16 |
static class Bean { |
| 17 |
public int value; |
| 18 |
} |
| 19 |
|
| 20 |
/* |
| 21 |
/********************************************************** |
| 22 |
/* Unit tests |
| 23 |
/********************************************************** |
| 24 |
*/ |
| 25 |
// Let's ensure indentation doesn't break anything (should be NOP) |
| 26 |
public void testIndent() throws Exception |
| 27 |
{ |
| 28 |
ObjectMapper mapper = new ObjectMapper(new SmileFactory()); |
| 29 |
mapper.configure(SerializationFeature.INDENT_OUTPUT, true); |
| 30 |
Bean bean = new Bean(); |
| 31 |
bean.value = 42; |
| 32 |
|
| 33 |
byte[] smile = mapper.writeValueAsBytes(bean); |
| 34 |
Bean result = mapper.readValue(smile, 0, smile.length, Bean.class); |
| 35 |
assertEquals(42, result.value); |
| 36 |
} |
| 37 |
} |