package org.realityforge.replicant.server.transport;

import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class ChannelMetaDataTest
{
  @Test
  public void typeGraph()
  {
    final ChannelMetaData metaData =
      new ChannelMetaData( 1, "MetaData", null, ChannelMetaData.FilterType.NONE, null, false );
    assertEquals( metaData.getChannelID(), 1 );
    assertEquals( metaData.getName(), "MetaData" );
    assertEquals( metaData.isTypeGraph(), true );
    assertEquals( metaData.isInstanceGraph(), false );
    assertEquals( metaData.getFilterType(), ChannelMetaData.FilterType.NONE );
    assertEquals( metaData.isCacheable(), false );

    assertThrows( metaData::getSubChannelType );
    assertThrows( metaData::getFilterParameterType );
  }

  @Test
  public void instanceGraph()
  {
    final ChannelMetaData metaData =
      new ChannelMetaData( 1, "MetaData", Integer.class, ChannelMetaData.FilterType.NONE, null, false );
    assertEquals( metaData.getChannelID(), 1 );
    assertEquals( metaData.getName(), "MetaData" );
    assertEquals( metaData.isTypeGraph(), false );
    assertEquals( metaData.isInstanceGraph(), true );
    assertEquals( metaData.getFilterType(), ChannelMetaData.FilterType.NONE );
    assertEquals( metaData.isCacheable(), false );
    assertEquals( metaData.getSubChannelType(), Integer.class );

    assertThrows( metaData::getFilterParameterType );
  }

  @Test
  public void filteredGraph()
  {
    final ChannelMetaData metaData =
      new ChannelMetaData( 1, "MetaData", Integer.class, ChannelMetaData.FilterType.STATIC, String.class, false );
    assertEquals( metaData.getChannelID(), 1 );
    assertEquals( metaData.getName(), "MetaData" );
    assertEquals( metaData.isTypeGraph(), false );
    assertEquals( metaData.isInstanceGraph(), true );
    assertEquals( metaData.getFilterType(), ChannelMetaData.FilterType.STATIC );
    assertEquals( metaData.getFilterParameterType(), String.class );
    assertEquals( metaData.isCacheable(), false );
    assertEquals( metaData.getSubChannelType(), Integer.class );
  }
}

@@ -2081,11 +2081,402 @@
 s );%0A  %7D
+%0A%0A  @Test%0A  public void badFilteredConfig()%0A  %7B%0A    assertThrows( () -%3E new ChannelMetaData( 1, %22X%22, null, ChannelMetaData.FilterType.STATIC, null, false ) );%0A    assertThrows( () -%3E new ChannelMetaData( 1, %22X%22, null, ChannelMetaData.FilterType.DYNAMIC, null, false ) );%0A    assertThrows( () -%3E new ChannelMetaData( 1, %22X%22, null, ChannelMetaData.FilterType.NONE, String.class, false ) );%0A  %7D
 %0A%7D%0A

Add some more tests