All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.mmm.marshall.test.AbstractXmlFormatTest Maven / Gradle / Ivy

The newest version!
package io.github.mmm.marshall.test;

import org.junit.jupiter.api.Test;

import io.github.mmm.marshall.StandardFormat;
import io.github.mmm.marshall.StructuredFormat;
import io.github.mmm.marshall.StructuredFormatFactory;
import io.github.mmm.marshall.StructuredFormatProvider;
import io.github.mmm.marshall.StructuredTextFormat;

/**
 * Abstract test of {@link StructuredTextFormat}.
 */
public abstract class AbstractXmlFormatTest extends StructuredTextFormatTest {

  @Override
  protected String getExpectedData(String indent, String newline) {

    boolean comments = getProvider().create().isSupportingComments();
    return "" + newline //
        + (comments ? "" + newline : "") //
        + "" + newline //
        + (comments ? indent + "" + newline : "") //
        + indent + "" + newline //
        + indent + "" + newline //
        + indent + "" + newline //
        + indent + indent + "" + newline //
        + indent + indent + "" + newline //
        + indent + indent + "" + newline //
        + indent + indent + "" + newline //
        + indent + indent + "" + newline //
        + indent + indent + "" + newline //
        + indent + indent + "" + newline //
        + indent + indent + "" + newline //
        + indent + indent + "" + newline //
        + indent + indent + "" + newline //
        + indent + indent + indent + "" + newline //
        + (comments ? indent + indent + indent + indent + "" + newline
            : "") //
        + indent + indent + indent + indent + "" + newline //
        + indent + indent + indent + "" + newline //
        + indent + indent + "" + newline //
        + indent + "" + newline //
        + indent + "" + newline //
        + indent + "" + newline //
        + "";
  }

  @Override
  protected String getExpectedDataForAtomicLong() {

    return "";
  }

  /**
   * Test with {@link StructuredFormat#ID_XML} and {@link StandardFormat#xml()}.
   */
  @Test
  public void testXmlFormat() {

    StructuredFormatProvider provider = StructuredFormatFactory.get().getProvider(StructuredFormat.ID_XML);
    StructuredFormat format = provider.create();
    assertThat(format).isSameAs(getProvider().create()).isSameAs(StandardFormat.xml());
    assertThat(format.isSupportingComments()).isTrue();
  }

}