/**
 * Copyright (C) 2014 Microsoft Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.microsoft.tang.test;

import com.microsoft.tang.ClassHierarchy;
import com.microsoft.tang.Configuration;
import com.microsoft.tang.Tang;
import com.microsoft.tang.implementation.protobuf.ProtocolBufferClassHierarchy;
import org.junit.Assert;
import org.junit.Test;

/**
 * Base class for roundtrip tests. The idea is that serializers implement roundTrip() and then get tested by the tests
 * in this class.
 */
public abstract class RoundTripTest {

  public abstract Configuration roundTrip(final Configuration configuration) throws Exception;
  public abstract Configuration roundTrip(final Configuration configuration, final ClassHierarchy classHierarchy) throws Exception;

  @Test
  public void testRoundTrip() throws Exception {
    // TODO: use 'getConfiguration' instead of 'getConfigurationWithoutList' after #192 is fixed
    final Configuration conf = ObjectTreeTest.getConfigurationWithoutList();
    final RootInterface before = Tang.Factory.getTang().newInjector(conf).getInstance(RootInterface.class);
    final RootInterface after = Tang.Factory.getTang().newInjector(roundTrip(conf)).getInstance(RootInterface.class);
    Assert.assertEquals("Configuration conversion to and from Avro datatypes failed.", before, after);
  }

  @Test
  public void testRoundTripWithClassHierarchy() throws Exception {
    // TODO: use 'getConfiguration' instead of 'getConfigurationWithoutList' after #192 is fixed
    final Configuration conf = ObjectTreeTest.getConfigurationWithoutList();
    final ClassHierarchy c = new ProtocolBufferClassHierarchy(ProtocolBufferClassHierarchy.serialize(conf.getClassHierarchy()));
    roundTrip(conf, c);
  }
}

@@ -2054,32 +2054,38 @@
 nfiguration conf
+Before
  = ObjectTreeTes
@@ -2222,16 +2222,22 @@
 ize(conf
+Before
 .getClas
@@ -2260,25 +2260,167 @@
     
-roundTrip(conf, c
+final Configuration confAfter = roundTrip(confBefore, c);%0A    Assert.assertEquals(confBefore.getNamedParameters().size(), confAfter.getNamedParameters().size()
 );%0A 

add Assert in ROundTripTest