Skip to content

Commit

Permalink
Reproduce issue
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Sep 14, 2022
1 parent cf61d54 commit 61e0ead
Showing 1 changed file with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.thoughtworks.xstream.converters.extended;

import com.thoughtworks.acceptance.AbstractAcceptanceTest;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;

public class AtomicBooleanFieldsTest extends AbstractAcceptanceTest {

public static class Musican {
public String name;
public String genre;
public AtomicBoolean alive;

public Musican(final String name, final String genre, final AtomicBoolean alive) {
this.name = name;
this.genre = genre;
this.alive = alive;
}
}

public void testAtomicBooleanFields() {
final List<Musican> jazzIcons = new ArrayList<>();
jazzIcons.add(new Musican("Miles Davis", "jazz", new AtomicBoolean(false)));
jazzIcons.add(new Musican("Wynton Marsalis", "jazz", new AtomicBoolean(true)));

xstream.alias("musician", Musican.class);

final String expectedXml =
"<list>\n"
+ " <musician>\n"
+ " <name>Miles Davis</name>\n"
+ " <genre>jazz</genre>\n"
+ " <alive>\n"
+ " <value>0</value>\n"
+ " </alive>\n"
+ " </musician>\n"
+ " <musician>\n"
+ " <name>Wynton Marsalis</name>\n"
+ " <genre>jazz</genre>\n"
+ " <alive>\n"
+ " <value>1</value>\n"
+ " </alive>\n"
+ " </musician>\n"
+ "</list>";

assertBothWays(jazzIcons, expectedXml);
}
}

0 comments on commit 61e0ead

Please sign in to comment.