<commit_before>package org.scalaide.ui.internal.preferences

import org.junit.Assert._
import org.junit.Test

class StringListSerializerTest {
  private def testWith(strs: String*): Unit = {
    val serialized = StringListSerializer.serialize(strs)
    val deserialized = StringListSerializer.deserialize(serialized)
    assertEquals(s"Error related to serialized representation '$serialized'", strs, deserialized)
  }

  private def expectExceptionOnDeserialize(str: String): Unit = {
    try {
      StringListSerializer.deserialize(str)
      throw new AssertionError(s"Expected IllegalArgumentException for input $str")
    } catch {
      case _: IllegalArgumentException => ()
    }
  }

  @Test
  def emptyList(): Unit = {
    testWith()
  }

  @Test
  def emptyString(): Unit = {
    testWith("")
  }

  @Test
  def singleString(): Unit = {
    testWith("single")
    testWith("0")
    testWith("1")
  }

  @Test
  def mulitpleStrings(): Unit = {
    testWith("a", "b")
    testWith("", "")
    testWith("", "", "")
    testWith("0", "0", "0")
    testWith("", "", "", "a", "b", "abc")
    testWith("0", "1", "   ", "a", "b", "abc", "\n", "12340")
  }

  @Test
  def noStackOverflow(): Unit = {
    testWith(Seq.fill(10000)(""): _*)
  }

  @Test
  def testWithIllegalInput(): Unit = {
    expectExceptionOnDeserialize("1")
    expectExceptionOnDeserialize("2|a")<commit_msg>Add test case<commit_after>package org.scalaide.ui.internal.preferences

import org.junit.Assert._
import org.junit.Test

class StringListSerializerTest {
  private def testWith(strs: String*): Unit = {
    val serialized = StringListSerializer.serialize(strs)
    val deserialized = StringListSerializer.deserialize(serialized)
    assertEquals(s"Error related to serialized representation '$serialized'", strs, deserialized)
  }

  private def expectExceptionOnDeserialize(str: String): Unit = {
    try {
      StringListSerializer.deserialize(str)
      throw new AssertionError(s"Expected IllegalArgumentException for input $str")
    } catch {
      case _: IllegalArgumentException => ()
    }
  }

  @Test
  def emptyList(): Unit = {
    testWith()
  }

  @Test
  def emptyString(): Unit = {
    testWith("")
  }

  @Test
  def singleString(): Unit = {
    testWith("single")
    testWith("0")
    testWith("1")
  }

  @Test
  def mulitpleStrings(): Unit = {
    testWith("a", "b")
    testWith("", "")
    testWith("", "", "")
    testWith("0", "0", "0")
    testWith("", "", "", "a", "b", "abc")
    testWith("0", "1", "   ", "a", "b", "abc", "\n", "12340")
  }

  @Test
  def withListOfSerializedLists(): Unit = {
    testWith(
        StringListSerializer.serialize(Seq()),
        StringListSerializer.serialize(Seq("")),
        StringListSerializer.serialize(Seq("", "1", "22")))
  }

  @Test
  def noStackOverflow(): Unit = {
    testWith(Seq.fill(10000)(""): _*)
  }

  @Test
  def testWithIllegalInput(): Unit = {
    expectExceptionOnDeserialize("1")
    expectExceptionOnDeserialize("2|a")
{'fraction_non_alphanumeric': 0.15914409896355733, 'fraction_numerical': 0.013707790036776997, 'mean_word_length': 3.588957055214724, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '145820', 'n_tokens_mistral': 973, 'n_tokens_neox': 947, 'n_words': 199}