/**
 * 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.implementation.java;

import com.microsoft.tang.Configuration;
import com.microsoft.tang.Tang;
import com.microsoft.tang.annotations.Name;
import com.microsoft.tang.annotations.NamedParameter;
import com.microsoft.tang.annotations.Parameter;
import com.microsoft.tang.formats.AvroConfigurationSerializer;
import com.microsoft.tang.formats.avro.AvroConfiguration;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import javax.inject.Inject;

/**
 * TestConfigurationBuilder
 */
public class TestConfigurationBuilder {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void nullStringVaueTest() {
        thrown.expect(IllegalStateException.class);
        thrown.expectMessage("The value null set to the named parameter is illegel: class com.microsoft.tang.implementation.java.TestConfigurationBuilder$NamedParamterNoDefault$NamedString");

        Configuration conf = Tang.Factory.getTang().newConfigurationBuilder()
                .bindNamedParameter(NamedParamterNoDefault.NamedString.class, (String) null)
        .build();

        final AvroConfiguration aConf = new AvroConfigurationSerializer().toAvro(conf);
        Configuration conf2 = new AvroConfigurationSerializer().fromAvro(aConf);
    }

    static class NamedParamterNoDefault
    {
        private String str;

        @NamedParameter()
        public class NamedString implements Name<String>
        {
        }

        @Inject
        public NamedParamterNoDefault(@Parameter(NamedString.class) String str)
        {
            this.str = str;
        }

        public String GetString()
        {
            return str;
        }
    }
}

@@ -1572,29 +1572,8 @@
     
- Configuration conf =
  Tan
@@ -1723,185 +1723,23 @@
     
-.build();%0A%0A        final AvroConfiguration aConf = new AvroConfigurationSerializer().toAvro(conf);%0A        Configuration conf2 = new AvroConfigurationSerializer().fromAvro(aConf
+        .build(
 );%0A 
@@ -1783,20 +1783,16 @@
 oDefault
-%0A   
  %7B%0A     
@@ -1794,16 +1794,22 @@
         
+final 
 private 
@@ -1855,23 +1855,16 @@
         
-public 
 class Na
@@ -1896,24 +1896,16 @@
 %3CString%3E
-%0A       
  %7B%0A     
@@ -1934,23 +1934,16 @@
         
-public 
 NamedPar
@@ -1998,24 +1998,16 @@
 ing str)
-%0A       
  %7B%0A     
@@ -2042,87 +2042,8 @@
    %7D
-%0A%0A        public String GetString()%0A        %7B%0A            return str;%0A        %7D
 %0A   

remove unused test code