Skip to content

Commit

Permalink
Test refactoring, add reproduction of #123
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 19, 2019
1 parent 1a9600d commit cb30196
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.fasterxml.jackson.dataformat.yaml.failing;
package com.fasterxml.jackson.dataformat.yaml;

import com.fasterxml.jackson.annotation.*;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;

public class GeratorWithMinimize50Test extends ModuleTestBase
public class GeneratorWithMinimize50Test extends ModuleTestBase
{
private final static YAMLMapper MINIM_MAPPER = new YAMLMapper();
static {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.fasterxml.jackson.dataformat.yaml.failing;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.*;

//for [dataformats-text#123], problem with YAML, Object Ids
public class ObjectId123Test extends ModuleTestBase
{
private final ObjectMapper MAPPER = newObjectMapper();

public void testObjectIdUsingNative() throws Exception
{
final String YAML_CONTENT =
"foo: &foo1\n" +
" value: bar\n" +
"boo: *foo1\n";
ScratchModel result = MAPPER.readValue(YAML_CONTENT, ScratchModel.class);
assertNotNull(result);
assertNotNull(result.foo);
assertNotNull(result. boo);
assertSame(result.foo, result.boo);
}

static class ScratchModel {
public StringHolder foo;
public StringHolder boo;
}

@JsonIdentityInfo(generator = ObjectIdGenerators.None.class)
static class StringHolder {
public String value;

@Override
public String toString() {
return value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Although native Object Ids work in general, Tree Model currently
* has issues with it (see [dataformat-yaml#24])
*/
public class ObjectIdTest extends ModuleTestBase
public class ObjectId24Test extends ModuleTestBase
{
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id")
static class Node
Expand Down

0 comments on commit cb30196

Please sign in to comment.