<commit_before>package com.github.legioth.propertysource.rebind;

import com.google.gwt.user.rebind.StringSourceWriter;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class StringTypeHandlerTest
{
  @DataProvider( name = "writeValues" )
  public Object[][] actionDescriptions()
  {
    return new Object[][]{
      new Object[]{ "hi", "\"hi\"" },
      new Object[]{ "1\n2", "\"1\\n2\"" },
      new Object[]{ "&", "\"&\"" },
      new Object[]{ "Å", "\"Å\"" },
    };
  }

  @Test( dataProvider = "writeValues" )
  public void writeValues( final String input, final String output )
  {
    final StringSourceWriter writer = new StringSourceWriter();
    StringTypeHandler.INSTANCE.writeValue( null, writer, input );
    assertEquals( writer.toString(), output );
  }
}<commit_msg>Add some more basic tests<commit_after>package com.github.legioth.propertysource.rebind;

import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.core.ext.typeinfo.JMethod;
import com.google.gwt.user.rebind.StringSourceWriter;
import java.util.Arrays;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.mockito.Mockito.*;
import static org.testng.Assert.*;

public class StringTypeHandlerTest
{
  @DataProvider( name = "writeValues" )
  public Object[][] actionDescriptions()
  {
    return new Object[][]{
      new Object[]{ "hi", "\"hi\"" },
      new Object[]{ "1\n2", "\"1\\n2\"" },
      new Object[]{ "&", "\"&\"" },
      new Object[]{ "Å", "\"Å\"" },
    };
  }

  @Test( dataProvider = "writeValues" )
  public void writeValues( final String input, final String output )
  {
    final StringSourceWriter writer = new StringSourceWriter();
    StringTypeHandler.INSTANCE.writeValue( null, writer, input );
    assertEquals( writer.toString(), output );
  }

  @Test
  public void getStaticReturnValue()
    throws Exception
  {
    final String result =
      StringTypeHandler.INSTANCE.getStaticReturnValue( mock( TreeLogger.class ),
                                                       Arrays.asList( "A" ),
                                                       mock( JMethod.class ) );

    assertEquals( result, "A" );
  }

  @Test
  public void getStaticReturnValue_whenMultipleValues()
    throws Exception
  {
      final TreeLogger logger = mock( TreeLogger.class );
    try
    {
      StringTypeHandler.INSTANCE.getStaticReturnValue( logger,
                                                       Arrays.asList( "A", "B" ),
                                                       mock( JMethod.class ) );
      fail( "Should have raised an exception" );
    }
    catch ( final UnableToCompleteException utce )
    {
      verify( logger ).log( Type.ERROR, "String only supported for properties with only one value" );
    }
  }
}
{'fraction_non_alphanumeric': 0.13232323232323231, 'fraction_numerical': 0.0026936026936026937, 'mean_word_length': 2.7044887780548628, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7062947', 'n_tokens_mistral': 848, 'n_tokens_neox': 841, 'n_words': 200}