<commit_before>package org.fusesource.scalate.introspector

/**
 * @version $Revision: 1.1 $
 */


import org.fusesource.scalate.Asserts
import org.fusesource.scalate.util.Logging
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
import java.io.File

case class MyProduct(name: String, age: Int) {}

class MyBean {
  var _name: String = _
  def getName() = _name
  def setName(name: String): Unit = _name = name

  var _age: Int = _
  def getAge() = _age
  def setAge(age: Int): Unit = _age = age
}

@RunWith(classOf[JUnitRunner])
class IntrospectorTest extends FunSuite with Logging {


  test("product introspector") {
    val introspector = Introspector(classOf[MyProduct])
    expect("myProduct") { introspector.typeStyleName }

    val properties = introspector.properties
    assertProperties(properties, 2)

    assertProperty(properties(0), "name", "name", classOf[String])
    assertProperty(properties(1), "age", "age", classOf[Int])
  }


  test("bean introspector") {
    val introspector = Introspector(classOf[MyBean])
    expect("myBean") { introspector.typeStyleName }

    val properties = introspector.properties
    assertProperties(properties, 2)

    assertProperty(properties(0), "age", "age", classOf[Int])
    assertProperty(properties(1), "name", "name", classOf[String])
  }


  def assertProperty(property: Property, name: String, label: String, propertyType: Class[_]) = {
    expect(name) {property.name}
    expect(label) {property.label}
    expect(propertyType) {property.propertyType}
  }

  def assertProperties(properties: Seq[Property], expectedSize: Int) = {
    for (property <- properties) {
      fine("Property: " + property)
    }
    expect(expectedSize) { properties.size }<commit_msg>fix for unit test which can change ordering based on platform it seems<commit_after>package org.fusesource.scalate.introspector

/**
 * @version $Revision: 1.1 $
 */


import org.fusesource.scalate.Asserts
import org.fusesource.scalate.util.Logging
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner
import java.io.File

case class MyProduct(name: String, age: Int) {}

class MyBean {
  var _name: String = _
  def getName() = _name
  def setName(name: String): Unit = _name = name

  var _age: Int = _
  def getAge() = _age
  def setAge(age: Int): Unit = _age = age
}

@RunWith(classOf[JUnitRunner])
class IntrospectorTest extends FunSuite with Logging {


  test("product introspector") {
    val introspector = Introspector(classOf[MyProduct])
    expect("myProduct") { introspector.typeStyleName }

    val properties = introspector.properties.sortBy(_.name)
    assertProperties(properties, 2)

    assertProperty(properties(0), "age", "age", classOf[Int])
    assertProperty(properties(1), "name", "name", classOf[String])
  }


  test("bean introspector") {
    val introspector = Introspector(classOf[MyBean])
    expect("myBean") { introspector.typeStyleName }

    val properties = introspector.properties.sortBy(_.name)
    assertProperties(properties, 2)

    assertProperty(properties(0), "age", "age", classOf[Int])
    assertProperty(properties(1), "name", "name", classOf[String])
  }


  def assertProperty(property: Property, name: String, label: String, propertyType: Class[_]) = {
    expect(name) {property.name}
    expect(label) {property.label}
    expect(propertyType) {property.propertyType}
  }

  def assertProperties(properties: Seq[Property], expectedSize: Int) = {
    for (property <- properties) {
      fine("Property: " + property)
    }
    expect(expectedSize) { properties.size }
{'fraction_non_alphanumeric': 0.12503427474636689, 'fraction_numerical': 0.004387167534960241, 'mean_word_length': 4.552511415525114, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7664450', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1130, 'n_words': 258}