wix/accord — pull request #24 by xeno-by (2014-07-12 10:06:51+00:00)
Title: almost solved the resetAllAttrs problem

I'm getting a single test failure that might or might not be relevant to what I've been doing. Could you take a look?

```
13:04 ~/Projects/accord (scala-2.11)$ sbt compile
[info] Loading project definition from /Users/xeno_by/Projects/accord/project
[info] Set current project to root (in build file:/Users/xeno_by/Projects/accord/)
[info] Compiling 1 Scala source to /Users/xeno_by/Projects/accord/core/target/scala-2.11/classes...
[success] Total time: 4 s, completed Jul 12, 2014 1:05:02 PM
13:05 ~/Projects/accord (scala-2.11)$ sbt test
[info] Loading project definition from /Users/xeno_by/Projects/accord/project
[info] Set current project to root (in build file:/Users/xeno_by/Projects/accord/)
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for root/test:test
[info] No tests to run for accord-api/test:test
[info] Compiling 1 Scala source to /Users/xeno_by/Projects/accord/scalatest/target/scala-2.11/test-classes...
[info] Compiling 1 Scala source to /Users/xeno_by/Projects/accord/specs2/target/scala-2.11/test-classes...
[info] Compiling 3 Scala sources to /Users/xeno_by/Projects/accord/spring3/target/scala-2.11/test-classes...
[info] Compiling 17 Scala sources to /Users/xeno_by/Projects/accord/core/target/scala-2.11/test-classes...
[info] ResultMatchersTest:
[info] RuleViolationMatcher
[info] - should correctly match a rule violation based on value
[info] - should correctly match a rule violation based on constraint
[info] - should correctly match a rule violation based on description
[info] - should fail to match a non-matching rule violation
[info] GroupViolationMatcher
[info] - should correctly match a group violation based on value
[info] - should correctly match a rule violation based on constraint
[info] - should correctly match a rule violation based on description
[info] - should correctly match a rule violation based on children
[info] - should fail to match a non-matching group violation due to a constraint on a group property
[info] - should fail to match a non-matching group violation due to a nonmatching child rule
[info] Matcher construction DSL
[info] - should generate a correct rule violation for a Tuple2[String, String]
[info] - should generate a correct group violation via group()
[info] failWith matcher
[info] - should succeed if a validation rule matches successfully
[info] - should fail if a validation rule does not match
[info] aSuccess matcher
[info] - should succeed if matching a Success
[info] - should fail if matching a Failure
[info] aFailure matcher
[info] - should fail if matching a Success
[info] - should succeed if matching a Failure
[info] Run completed in 824 milliseconds.
[info] Total number of tests run: 18
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 18, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[info] CompanionObjectAccordValidatorResolverTest:
[info] CompanionObjectAccordResolver
[info] - should successfully resolve a validator when available on a test class companion
[info] - should return None when no validator is available on the test class companion
[info] AccordValidatorAdapterTest:
[info] The validation adapter
[info] - should find and apply an Accord validator in a companion object
[info] - should correctly render a validation error
[info] - should correctly render multiple validation errors
Jul 12, 2014 1:05:21 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.GenericApplicationContext@9f43fcb: startup date [Sat Jul 12 13:05:21 FET 2014]; root of context hierarchy
Jul 12, 2014 1:05:22 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7e498cf5: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,accordEnabledLocalValidationFactoryTest.SpringValidationConfiguration,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,resolver,validator]; root of factory hierarchy
[info] ResultMatchersSpec
[info]
[info] RuleViolationMatcher should
[info] + correctly match a rule violation based on value
[info] + correctly match a rule violation based on constraint
[info] + correctly match a rule violation based on description
[info] + fail to match a non-matching rule violation
[info]
[info] GroupViolationMatcher should
[info] + correctly match a group violation based on value
[info] + correctly match a rule violation based on constraint
[info] + correctly match a rule violation based on description
[info] + correctly match a rule violation based on children
[info] + fail to match a non-matching group violation due to a constraint on a group property
[info] + fail to match a non-matching group violation due to a nonmatching child rule
[info]
[info] Matcher construction DSL should
[info] + generate a correct rule violation for a Tuple2[String, String]
[info] + generate a correct group violation via group()
[info]
[info] failWith matcher should
[info] + succeed if a validation rule matches successfully
[info] + fail if a validation rule does not match
[info]
[info] succeed matcher should
[info] + succeed if matching a Success
[info] + fail if matching a Failure
[info]
[info] fail matcher should
[info] + fail if matching a Success
[info] + succeed if matching a Failure
[info]
[info] Total for specification ResultMatchersSpec
[info] Finished in 63 ms
[info] 18 examples, 0 failure, 0 error
[info] AccordEnabledLocalValidationFactoryTest:
[info] The validation factory
[info] - should find and apply an Accord validator in a companion object
[info] - should fall back to JSR 303 validation if an Accord validator is unavailable
[info] Passed: Total 18, Failed 0, Errors 0, Passed 18
[info] Run completed in 2 seconds, 552 milliseconds.
[info] Total number of tests run: 7
[info] Suites: completed 3, aborted 0
[info] Tests: succeeded 7, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[info] AlternativeValidationSyntaxTests:
[info] Importing com.wix.accord.Implicits
[info] - should enable alternative validation invocation syntax
[info] OptionOpsTests:
[info] Option.each
[info] - should succeed on None
[info] - should succeed on Some that matches the predicate
[info] - should fail on Some that does not match the predicate
[info] empty
[info] - should succeed on None
[info] - should fail on Some
[info] notEmpty
[info] - should succeed on Some
[info] - should fail on None
[info] Option.get
[info] - should throw NoSuchElementException on None
[info] - should succeed on Some that matches the predicate
[info] - should fail on Some that does not match the predicate
[info] StringOpsTests:
[info] startWith
[info] - should successfully validate a correct string
[info] - should successfully validate an incorrect string
[info] endWith
[info] - should successfully validate a correct string
[info] - should successfully validate an incorrect string
[info] matchRegex
[info] - should successfully validate a correct string based on a text pattern
[info] - should successfully validate an incorrect string based on a text pattern
[info] - should successfully validate a correct string based on a Scala regex
[info] - should successfully validate an incorrect string based on a Scala regex
[info] - should successfully validate a correct string based on a java.util.regex.Pattern
[info] - should successfully validate an incorrect string based on a java.util.regex.Pattern
[info] matchRegexFully
[info] - should successfully validate a correct string based on a text pattern
[info] - should successfully validate an incorrect string based on a text pattern
[info] - should successfully validate a correct string based on a Scala regex
[info] - should successfully validate an incorrect string based on a Scala regex
[info] - should successfully validate a correct string based on a java.util.regex.Pattern
[info] - should successfully validate an incorrect string based on a java.util.regex.Pattern
[info] CollectionCombinatorTests:
[info] Empty combinator
[info] - should successfully validate an empty option
[info] - should successfully validate an empty string
[info] - should successfully validate an empty sequence
[info] - should render a correct rule violation
[info] NotEmpty combinator
[info] - should successfully validate a non-empty option
[info] - should successfully validate a non-empty string
[info] - should successfully validate a non-empty sequence
[info] - should render a correct rule violation
[info] CollectionOpsTests:
[info] empty
[info] - should successfully validate a empty collection
[info] - should successfully validate a non-empty collection
[info] notEmpty
[info] - should successfully validate a non-empty collection
[info] - should successfully validate a empty collection
[info] size extensions
[info] - should generate a correctly prefixed constraint
[info] each extension
[info] - should be null safe
[info] Issue10:
[info] Size DSL on an option
[info] - should not throw a StackOverflowError in runtime
[info] OrderingOpsTests:
[info] OrderingOps as exposed by dsl
[info] - should correctly evaluate an int-based rule
[info] - should correctly evaluate a float-based rule
[info] - should correctly evaluate a double-based rule
[info] - should correctly evaluate a BigDecimal-based rule
[info] - should correctly evaluate a string-based rule
[info] - should correctly evaluate a rule on an arbitrary class with Ordering
[info] OrderingOps between combinator extensions
[info] - should correctly evaluate an inclusive rule
[info] - should correctly evaluate an exclusive rule
[info] - should correctly evaluate an inclusive range rule
[info] - should correctly evaluate an exculsive range rule
[info] Issue7:
[info] nullSafeValidator
[info] - should fail on notNull validation
[info] BooleanOpsTests:
[info] true
[info] - should succeed on true
[info] - should fail on false
[info] false
[info] - should succeed on false
[info] - should fail on true
[info] OrderingCombinatorTests:
[info] GreaterThan combinator
[info] - should successfully validate a greater object
[info] - should render a correct rule violation
[info] GreaterThanOrEqual combinator
[info] - should successfully validate a greater object
[info] - should successfully validate an equal object
[info] - should render a correct rule violation
[info] LesserThan combinator
[info] - should successfully validate a lesser object
[info] - should render a correct rule violation
[info] LesserThanOrEqual combinator
[info] - should successfully validate a lesser object
[info] - should successfully validate an equal object
[info] - should render a correct rule violation
[info] EquivalentTo combinator
[info] - should successfully validate an equal object
[info] - should render a correct rule violation
[info] Between combinator
[info] - should successfully validate an object within the specified range
[info] - should render a correct rule violation
[info] Between combinator with exclusive modifier
[info] - should successfully validate an object within the specified range
[info] - should render a correct rule violation
[info] BaseValidatorTests:
[info] BaseValidator.report
[info] - should return a Failure with a default violation on nulls
[info] - should return a Success if test succeeds
[info] - should return a Failure with the generated violations if test fails
[info] ExpressionDescriberTests:
[info] ExpressionDescriber.describe over a single-parameter function literal
[info] - should render a correct description for expressions over the function parameter members
[info] - should propagate an explicitly-described expression
[info] - should fall back to the expression tree itself for unsupported expressions
[info] ExpressionDescriber.describe
[info] - should generate a compile-time error for function parameters !!! IGNORED !!!
[info] BooleanCombinatorTests:
[info] IsTrue combinator
[info] - should successfully validate the value true
[info] - should render a correct rule violation
[info] IsFalse combinator
[info] - should successfully validate the value false
[info] - should render a correct rule violation
[info] StringCombinatorTests:
[info] StartsWith combinator
[info] - should successfully validate a string that starts with the specified prefix
[info] - should render a correct rule violation
[info] EndsWith combinator
[info] - should successfully validate a string that ends with the specified prefix
[info] - should render a correct rule violation
[info] MatchesRegex combinator
[info] - should successfully validate a string that partially matches specified pattern if partial match is allowed
[info] - should fail to validate a string that partially matches specified pattern if partial match is not allowed
[info] - should successfully validate a string that fully matches specified pattern even if partial match is not allowed
[info] - should render a correct rule violation on partial match failure
[info] - should render a correct rule violation on full match failure
[info] GeneralPurposeCombinatorTests:
[info] And combinator with a two-clause rule
[info] - should successfully validate a object that satisfies both clauses
[info] - should render a correct rule violation when the first clause is not satisfied
[info] - should render a correct rule violation when the second clause is not satisfied
[info] - should render a correct rule violation when both clauses are not satisfied
[info] Or combinator with a two-clause rule
[info] - should successfully validate a object that satisfies both clauses
[info] - should successfully validate an object that only satisfies the first clause
[info] - should successfully validate an object that only satisfies the second clause
[info] - should render a correct rule violation when both clauses are not satisfied
[info] Fail combinator
[info] - should render a correct rule violation
[info] Nil validator
[info] - should successfully validate an arbitrary object
[info] EqualTo validator
[info] - should successfully validate an equal object
[info] - should render a correct rule violation
[info] NotEqualTo validator
[info] - should successfully validate an unequal object
[info] - should render a correct rule violation
[info] IsNull validator
[info] - should successfully validate a null of an arbitrary type
[info] - should render a correct rule violation
[info] IsNotNull validator
[info] - should successfully validate an instance of an arbitrary type
[info] - should render a correct rule violation
[info] Valid validator
[info] - should be null-safe
[info] ValidationTransformTests:
[info] Validator description
[info] - should be generated for a fully-qualified field selector
[info] - should be generated for an anonymously-qualified field selector
[info] - should be generated for an anonymous value reference
[info] - should be generated for a fully-qualified selector with multiple indirections
[info] - should be generated for an anonymously-qualified selector with multiple indirections
[info] - should be propagated for an explicitly-described expression
[info] - should be propagated for a composite validator
[info] - should be propagated for an adapted validator *** FAILED ***
[info] Validation of Failure(Set(RuleViolation(null,is a null,Some(value)))) failed!
[info] Unexpected violations:
[info]	RuleViolation(null,is a null,Some(value))
[info] Expected violations that weren't found:
[info]	RuleViolation(_,is a null,field) (ValidationTransformTests.scala:52)
[info] Run completed in 695 milliseconds.
[info] Total number of tests run: 119
[info] Suites: completed 16, aborted 0
[info] Tests: succeeded 118, failed 1, canceled 0, ignored 1, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed tests:
[error]	com.wix.accord.tests.transform.ValidationTransformTests
[error] (accord-core/test:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 17 s, completed Jul 12, 2014 1:05:29 PM
```