import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
+import org.eclipse.xtend2.lib.StringConcatenation;
import org.junit.Test;
import org.opendaylight.mdsal.binding.generator.impl.DefaultBindingGenerator;
import org.opendaylight.mdsal.binding.model.api.GeneratedType;
public void builderTemplateGenerateHashcodeWithPropertyTest() {
final GeneratedType genType = mockGenType("get" + TEST);
- assertEquals("/**\n"
+ assertXtendEquals("/**\n"
+ " * Default implementation of {@link Object#hashCode()} contract for this interface.\n"
+ " * Implementations of this interface are encouraged to defer to this method to get consistent"
+ " hashing\n"
@Test
public void builderTemplateGenerateHashCodeWithMorePropertiesTest() throws Exception {
- assertEquals("/**\n"
+ assertXtendEquals("/**\n"
+ " * Default implementation of {@link Object#hashCode()} contract for this interface.\n"
+ " * Implementations of this interface are encouraged to defer to this method to get consistent"
+ " hashing\n"
@Test
public void builderTemplateGenerateHashCodeWithoutPropertyWithAugmentTest() throws Exception {
- assertEquals("/**\n"
+ assertXtendEquals("/**\n"
+ " * Default implementation of {@link Object#hashCode()} contract for this interface.\n"
+ " * Implementations of this interface are encouraged to defer to this method to get consistent"
+ " hashing\n"
@Test
public void builderTemplateGenerateHashCodeWithPropertyWithAugmentTest() throws Exception {
- assertEquals("/**\n"
+ assertXtendEquals("/**\n"
+ " * Default implementation of {@link Object#hashCode()} contract for this interface.\n"
+ " * Implementations of this interface are encouraged to defer to this method to get consistent"
+ " hashing\n"
@Test
public void builderTemplateGenerateHashCodeWithMorePropertiesWithAugmentTest() throws Exception {
- assertEquals("/**\n"
+ assertXtendEquals("/**\n"
+ " * Default implementation of {@link Object#hashCode()} contract for this interface.\n"
+ " * Implementations of this interface are encouraged to defer to this method to get consistent"
+ " hashing\n"
public void builderTemplateGenerateToStringWithPropertyTest() {
final GeneratedType genType = mockGenType("get" + TEST);
- assertEquals("/**\n"
+ assertXtendEquals("/**\n"
+ " * Default implementation of {@link Object#toString()} contract for this interface.\n"
+ " * Implementations of this interface are encouraged to defer to this method to get consistent string"
+ "\n * representations across all implementations.\n"
@Test
public void builderTemplateGenerateToStringWithoutAnyPropertyTest() throws Exception {
- assertEquals("/**\n"
+ assertXtendEquals("/**\n"
+ " * Default implementation of {@link Object#toString()} contract for this interface.\n"
+ " * Implementations of this interface are encouraged to defer to this method to get consistent string"
+ "\n * representations across all implementations.\n"
@Test
public void builderTemplateGenerateToStringWithMorePropertiesTest() throws Exception {
- assertEquals("/**\n"
+ assertXtendEquals("/**\n"
+ " * Default implementation of {@link Object#toString()} contract for this interface.\n"
+ " * Implementations of this interface are encouraged to defer to this method to get consistent string"
+ "\n * representations across all implementations.\n"
@Test
public void builderTemplateGenerateToStringWithoutPropertyWithAugmentTest() throws Exception {
- assertEquals("/**\n"
+ assertXtendEquals("/**\n"
+ " * Default implementation of {@link Object#toString()} contract for this interface.\n"
+ " * Implementations of this interface are encouraged to defer to this method to get consistent string"
+ "\n * representations across all implementations.\n"
@Test
public void builderTemplateGenerateToStringWithPropertyWithAugmentTest() throws Exception {
- assertEquals("/**\n"
+ assertXtendEquals("/**\n"
+ " * Default implementation of {@link Object#toString()} contract for this interface.\n"
+ " * Implementations of this interface are encouraged to defer to this method to get consistent string"
+ "\n * representations across all implementations.\n"
@Test
public void builderTemplateGenerateToStringWithMorePropertiesWithAugmentTest() throws Exception {
- assertEquals("/**\n"
+ assertXtendEquals("/**\n"
+ " * Default implementation of {@link Object#toString()} contract for this interface.\n"
+ " * Implementations of this interface are encouraged to defer to this method to get consistent string"
+ "\n * representations across all implementations.\n"
doReturn(ValueMechanics.NORMAL).when(methSign).getMechanics();
return methSign;
}
+
+ // Xtend's StringConcatenation is using runtime-configured line separator, which can change between runs, notably
+ // it has a different value on Windows. Make sure we account for that.
+ private static void assertXtendEquals(final String expected, final String actual) {
+ assertEquals(expected.replace("\n", StringConcatenation.DEFAULT_LINE_DELIMITER), actual);
+ }
}