Skip to content

Commit cb30196

Browse files
committed
Test refactoring, add reproduction of #123
1 parent 1a9600d commit cb30196

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/failing/ObjectId63Test.java renamed to yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ObjectId63Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package com.fasterxml.jackson.dataformat.yaml.failing;
1+
package com.fasterxml.jackson.dataformat.yaml;
2+
3+
import com.fasterxml.jackson.annotation.*;
24

3-
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
4-
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
55
import com.fasterxml.jackson.databind.ObjectMapper;
66
import com.fasterxml.jackson.dataformat.yaml.*;
77

yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/failing/GeratorWithMinimize50Test.java renamed to yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/failing/GeneratorWithMinimize50Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
88
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
99

10-
public class GeratorWithMinimize50Test extends ModuleTestBase
10+
public class GeneratorWithMinimize50Test extends ModuleTestBase
1111
{
1212
private final static YAMLMapper MINIM_MAPPER = new YAMLMapper();
1313
static {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.fasterxml.jackson.dataformat.yaml.failing;
2+
3+
import com.fasterxml.jackson.annotation.*;
4+
import com.fasterxml.jackson.databind.ObjectMapper;
5+
import com.fasterxml.jackson.dataformat.yaml.*;
6+
7+
//for [dataformats-text#123], problem with YAML, Object Ids
8+
public class ObjectId123Test extends ModuleTestBase
9+
{
10+
private final ObjectMapper MAPPER = newObjectMapper();
11+
12+
public void testObjectIdUsingNative() throws Exception
13+
{
14+
final String YAML_CONTENT =
15+
"foo: &foo1\n" +
16+
" value: bar\n" +
17+
"boo: *foo1\n";
18+
ScratchModel result = MAPPER.readValue(YAML_CONTENT, ScratchModel.class);
19+
assertNotNull(result);
20+
assertNotNull(result.foo);
21+
assertNotNull(result. boo);
22+
assertSame(result.foo, result.boo);
23+
}
24+
25+
static class ScratchModel {
26+
public StringHolder foo;
27+
public StringHolder boo;
28+
}
29+
30+
@JsonIdentityInfo(generator = ObjectIdGenerators.None.class)
31+
static class StringHolder {
32+
public String value;
33+
34+
@Override
35+
public String toString() {
36+
return value;
37+
}
38+
}
39+
}

yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/failing/ObjectIdTest.java renamed to yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/failing/ObjectId24Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Although native Object Ids work in general, Tree Model currently
1111
* has issues with it (see [dataformat-yaml#24])
1212
*/
13-
public class ObjectIdTest extends ModuleTestBase
13+
public class ObjectId24Test extends ModuleTestBase
1414
{
1515
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id")
1616
static class Node

0 commit comments

Comments
 (0)