From c921572f60c24942e8d2f6dcd4d9d6fbcb9ce97a Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Tue, 31 Jan 2017 21:15:43 -0300 Subject: [PATCH 1/2] Add support for configuring the error to raise --- .../testFailFastConfiguringErrorToRaise.st | 22 +++++++++++++++++++ ...ButOnlyOneFailedConfiguringErrorToRaise.st | 20 +++++++++++++++++ .../methodProperties.json | 2 ++ .../instance/testEnforceOneFactFailing.st | 7 ++++++ .../testEnforceOneFactFailingRaisingError.st | 8 +++++++ ...neFactFailingRaisingNonDefaultException.st | 11 ++++++++++ .../instance/testEnforceOneFactNotFailing.st | 6 +++++ .../instance/testJustCheckOneFactFailing.st | 7 ------ .../testJustCheckOneFactNotFailing.st | 4 ---- .../methodProperties.json | 6 +++-- .../monticello.meta/version | 2 +- .../class/enforce.because..st | 4 ++++ .../class/enforce.because.raising..st | 9 ++++++++ .../class/justCheck.because..st | 9 -------- .../methodProperties.json | 3 ++- .../instance/build.st | 2 +- .../instance/initialize.st | 1 + .../instance/raising..st | 4 ++++ .../methodProperties.json | 5 +++-- .../properties.json | 3 ++- .../class/defaultError.st | 4 ++++ .../class/raising..st | 4 ++++ .../methodProperties.json | 5 ++++- .../class/new.st | 4 ---- .../class/raising..st | 4 ++++ .../instance/applyTo..st | 2 +- .../instance/initialize.st | 5 ----- .../instance/initializeRaising..st | 5 +++++ .../methodProperties.json | 6 ++--- .../properties.json | 3 ++- .../InstanceCreationFailed.class/README.md | 1 + .../methodProperties.json | 4 ++++ .../properties.json | 11 ++++++++++ .../class/raising..st | 4 ++++ .../instance/assertionFailedBecause..st | 2 +- .../instance/initializeRaising..st | 4 ++++ .../methodProperties.json | 7 ++++-- .../properties.json | 4 +++- source/Buoy.package/monticello.meta/version | 2 +- 39 files changed, 168 insertions(+), 48 deletions(-) create mode 100644 source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testFailFastConfiguringErrorToRaise.st create mode 100644 source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testSeveralConditionsButOnlyOneFailedConfiguringErrorToRaise.st create mode 100644 source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailing.st create mode 100644 source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingError.st create mode 100644 source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingNonDefaultException.st create mode 100644 source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactNotFailing.st delete mode 100644 source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testJustCheckOneFactFailing.st delete mode 100644 source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testJustCheckOneFactNotFailing.st create mode 100644 source/Buoy.package/AssertionChecker.class/class/enforce.because..st create mode 100644 source/Buoy.package/AssertionChecker.class/class/enforce.because.raising..st delete mode 100644 source/Buoy.package/AssertionChecker.class/class/justCheck.because..st create mode 100644 source/Buoy.package/AssertionCheckerBuilder.class/instance/raising..st create mode 100644 source/Buoy.package/AssertionFailurePolicy.class/class/defaultError.st create mode 100644 source/Buoy.package/AssertionFailurePolicy.class/class/raising..st delete mode 100644 source/Buoy.package/CollectingAssertionFailuresPolicy.class/class/new.st create mode 100644 source/Buoy.package/CollectingAssertionFailuresPolicy.class/class/raising..st delete mode 100644 source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/initialize.st create mode 100644 source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/initializeRaising..st create mode 100644 source/Buoy.package/InstanceCreationFailed.class/README.md create mode 100644 source/Buoy.package/InstanceCreationFailed.class/methodProperties.json create mode 100644 source/Buoy.package/InstanceCreationFailed.class/properties.json create mode 100644 source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/class/raising..st create mode 100644 source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/instance/initializeRaising..st diff --git a/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testFailFastConfiguringErrorToRaise.st b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testFailFastConfiguringErrorToRaise.st new file mode 100644 index 0000000..403179a --- /dev/null +++ b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testFailFastConfiguringErrorToRaise.st @@ -0,0 +1,22 @@ +tests +testFailFastConfiguringErrorToRaise + + | mathFailureExplanation | + + mathFailureExplanation := 'An obvious math error'. + checkerBuilder + failFast; + raising: InstanceCreationFailed; + checking: [ :asserter | + asserter + enforce: [ 2 > 3 ] because: mathFailureExplanation; + enforce: [ self fail ] because: [ self fail ]; + enforce: [ self fail ] because: [ self fail ] ]. + + self + should: [ checkerBuilder buildAndCheck ] + raise: InstanceCreationFailed + withExceptionDo: [ :exception | + self + assert: exception messageText equals: mathFailureExplanation; + assertCollection: exception failures hasSameElements: {mathFailureExplanation} ] \ No newline at end of file diff --git a/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testSeveralConditionsButOnlyOneFailedConfiguringErrorToRaise.st b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testSeveralConditionsButOnlyOneFailedConfiguringErrorToRaise.st new file mode 100644 index 0000000..ec4b327 --- /dev/null +++ b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testSeveralConditionsButOnlyOneFailedConfiguringErrorToRaise.st @@ -0,0 +1,20 @@ +tests +testSeveralConditionsButOnlyOneFailedConfiguringErrorToRaise + + | mathFailureExplanation | + + mathFailureExplanation := 'An obvious math error'. + checkerBuilder + raising: InstanceCreationFailed; + checking: [ :asserter | + asserter + enforce: [ 4 > 3 ] because: [ self fail ]; + enforce: [ 1 > 2 ] because: mathFailureExplanation; + enforce: [ #() isEmpty ] because: [ self fail ] ]. + self + should: [ checkerBuilder buildAndCheck ] + raise: InstanceCreationFailed + withExceptionDo: [ :exception | + self + assert: exception messageText equals: mathFailureExplanation; + assertCollection: exception failures hasSameElements: {mathFailureExplanation} ] \ No newline at end of file diff --git a/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/methodProperties.json b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/methodProperties.json index 36231b9..5b95814 100644 --- a/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/methodProperties.json +++ b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/methodProperties.json @@ -2,6 +2,8 @@ "instance" : { "testWithoutFailures" : "GabrielOmarCotelli 1/26/2017 19:50", "testConditionalChecking" : "GabrielOmarCotelli 1/26/2017 19:50", + "testSeveralConditionsButOnlyOneFailedConfiguringErrorToRaise" : "GabrielOmarCotelli 1/31/2017 21:06", + "testFailFastConfiguringErrorToRaise" : "GabrielOmarCotelli 1/31/2017 21:06", "testConditionalCheckingWhenFirstConditionFails" : "GabrielOmarCotelli 1/26/2017 19:50", "testSeveralConditionsButOnlyOneFailed" : "GabrielOmarCotelli 1/26/2017 19:50", "testSingleConditionFailure" : "GabrielOmarCotelli 1/26/2017 19:50", diff --git a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailing.st b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailing.st new file mode 100644 index 0000000..a98b886 --- /dev/null +++ b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailing.st @@ -0,0 +1,7 @@ +tests +testEnforceOneFactFailing + + | explanation | + + explanation := 'A false statement'. + self should: [ AssertionChecker enforce: [ false ] because: explanation ] raise: AssertionFailed withExceptionDo: [ :exception | self assert: exception messageText equals: explanation ] \ No newline at end of file diff --git a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingError.st b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingError.st new file mode 100644 index 0000000..01964a3 --- /dev/null +++ b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingError.st @@ -0,0 +1,8 @@ +tests +testEnforceOneFactFailingRaisingError + + | explanation | + + explanation := 'A false statement'. + "For single fact checking any exception can be configured to be raised" + self should: [ AssertionChecker enforce: [ false ] because: explanation raising: Error ] raise: Error withExceptionDo: [ :exception | self assert: exception messageText equals: explanation ] \ No newline at end of file diff --git a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingNonDefaultException.st b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingNonDefaultException.st new file mode 100644 index 0000000..283f605 --- /dev/null +++ b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingNonDefaultException.st @@ -0,0 +1,11 @@ +tests +testEnforceOneFactFailingRaisingNonDefaultException + + | explanation | + + explanation := 'A false statement'. + + self + should: [ AssertionChecker enforce: [ false ] because: explanation raising: InstanceCreationFailed ] + raise: InstanceCreationFailed + withExceptionDo: [ :exception | self assert: exception messageText equals: explanation ] \ No newline at end of file diff --git a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactNotFailing.st b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactNotFailing.st new file mode 100644 index 0000000..bc408ac --- /dev/null +++ b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactNotFailing.st @@ -0,0 +1,6 @@ +tests +testEnforceOneFactNotFailing + + self + shouldnt: [ AssertionChecker enforce: [ true ] because: [ self fail ] ] raise: AssertionFailed; + shouldnt: [ AssertionChecker enforce: [ true ] because: [ self fail ] raising: InstanceCreationFailed ] raise: InstanceCreationFailed \ No newline at end of file diff --git a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testJustCheckOneFactFailing.st b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testJustCheckOneFactFailing.st deleted file mode 100644 index 2782206..0000000 --- a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testJustCheckOneFactFailing.st +++ /dev/null @@ -1,7 +0,0 @@ -tests -testJustCheckOneFactFailing - - | explanation | - - explanation := 'A false statement'. - self should: [ AssertionChecker justCheck: [ false ] because: explanation ] raise: AssertionFailed withExceptionDo: [ :exception | self assert: exception messageText equals: explanation ] \ No newline at end of file diff --git a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testJustCheckOneFactNotFailing.st b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testJustCheckOneFactNotFailing.st deleted file mode 100644 index 0a42c4b..0000000 --- a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testJustCheckOneFactNotFailing.st +++ /dev/null @@ -1,4 +0,0 @@ -tests -testJustCheckOneFactNotFailing - - self shouldnt: [ AssertionChecker justCheck: [ true ] because: [ self fail ] ] raise: AssertionFailed \ No newline at end of file diff --git a/source/Buoy-Tests.package/AssertionCheckerTest.class/methodProperties.json b/source/Buoy-Tests.package/AssertionCheckerTest.class/methodProperties.json index 39b7d5f..cb4693e 100644 --- a/source/Buoy-Tests.package/AssertionCheckerTest.class/methodProperties.json +++ b/source/Buoy-Tests.package/AssertionCheckerTest.class/methodProperties.json @@ -1,7 +1,9 @@ { "instance" : { - "testJustCheckOneFactFailing" : "GabrielOmarCotelli 1/25/2017 22:01", - "testJustCheckOneFactNotFailing" : "GabrielOmarCotelli 1/25/2017 22:00" + "testEnforceOneFactFailingRaisingNonDefaultException" : "GabrielOmarCotelli 1/31/2017 20:19", + "testEnforceOneFactFailing" : "GabrielOmarCotelli 1/31/2017 20:16", + "testEnforceOneFactNotFailing" : "GabrielOmarCotelli 1/31/2017 20:57", + "testEnforceOneFactFailingRaisingError" : "GabrielOmarCotelli 1/31/2017 21:08" }, "class" : { } } \ No newline at end of file diff --git a/source/Buoy-Tests.package/monticello.meta/version b/source/Buoy-Tests.package/monticello.meta/version index f80b2c5..c0e6705 100644 --- a/source/Buoy-Tests.package/monticello.meta/version +++ b/source/Buoy-Tests.package/monticello.meta/version @@ -1 +1 @@ -(name 'Buoy-Tests-GabrielOmarCotelli.3' message 'Add Holders ' id '21414a7c-6b1d-134d-a01a-dad169c438de' date '27 January 2017' time '6:47:13.88642 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.2' message 'Renamed a method' id '4db25a31-cdbf-4d66-8e72-877e298b1b47' date '26 January 2017' time '7:51:46.200684 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.1' message 'Renamed packages' id '714b9a68-e0b3-4b48-be06-7b3f27f4ce47' date '26 January 2017' time '7:29:43.673983 pm' author 'GabrielOmarCotelli' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Buoy-Tests-GabrielOmarCotelli.4' message 'Add test cases' id 'eebeab3b-1eda-4b0c-955e-450bc100b05a' date '31 January 2017' time '9:13:55.838186 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.3' message 'Add Holders ' id '21414a7c-6b1d-134d-a01a-dad169c438de' date '27 January 2017' time '6:47:13.88642 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.2' message 'Renamed a method' id '4db25a31-cdbf-4d66-8e72-877e298b1b47' date '26 January 2017' time '7:51:46.200684 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.1' message 'Renamed packages' id '714b9a68-e0b3-4b48-be06-7b3f27f4ce47' date '26 January 2017' time '7:29:43.673983 pm' author 'GabrielOmarCotelli' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/source/Buoy.package/AssertionChecker.class/class/enforce.because..st b/source/Buoy.package/AssertionChecker.class/class/enforce.because..st new file mode 100644 index 0000000..f634631 --- /dev/null +++ b/source/Buoy.package/AssertionChecker.class/class/enforce.because..st @@ -0,0 +1,4 @@ +checking +enforce: aFact because: aStringOrBlockExplanation + + ^ self enforce: aFact because: aStringOrBlockExplanation raising: AssertionFailed \ No newline at end of file diff --git a/source/Buoy.package/AssertionChecker.class/class/enforce.because.raising..st b/source/Buoy.package/AssertionChecker.class/class/enforce.because.raising..st new file mode 100644 index 0000000..54ec984 --- /dev/null +++ b/source/Buoy.package/AssertionChecker.class/class/enforce.because.raising..st @@ -0,0 +1,9 @@ +checking +enforce: aFact because: aStringOrBlockExplanation raising: errorClass + + ^ (self + applying: (RaiseOnFirstAssertionFailurePolicy raising: errorClass) + to: + (Asserter new + enforce: aFact because: aStringOrBlockExplanation; + yourself)) check \ No newline at end of file diff --git a/source/Buoy.package/AssertionChecker.class/class/justCheck.because..st b/source/Buoy.package/AssertionChecker.class/class/justCheck.because..st deleted file mode 100644 index 2856b5c..0000000 --- a/source/Buoy.package/AssertionChecker.class/class/justCheck.because..st +++ /dev/null @@ -1,9 +0,0 @@ -instance creation -justCheck: aFact because: aStringOrBlockExplanation - - ^ (self - applying: RaiseOnFirstAssertionFailurePolicy new - to: - (Asserter new - enforce: aFact because: aStringOrBlockExplanation; - yourself)) check \ No newline at end of file diff --git a/source/Buoy.package/AssertionChecker.class/methodProperties.json b/source/Buoy.package/AssertionChecker.class/methodProperties.json index 0a02928..594be10 100644 --- a/source/Buoy.package/AssertionChecker.class/methodProperties.json +++ b/source/Buoy.package/AssertionChecker.class/methodProperties.json @@ -5,6 +5,7 @@ }, "class" : { "applying:to:" : "GabrielOmarCotelli 1/25/2017 21:51", - "justCheck:because:" : "GabrielOmarCotelli 1/26/2017 19:50" + "enforce:because:" : "GabrielOmarCotelli 1/31/2017 20:55", + "enforce:because:raising:" : "GabrielOmarCotelli 1/31/2017 20:55" } } \ No newline at end of file diff --git a/source/Buoy.package/AssertionCheckerBuilder.class/instance/build.st b/source/Buoy.package/AssertionCheckerBuilder.class/instance/build.st index 3d3a1ba..a67eb41 100644 --- a/source/Buoy.package/AssertionCheckerBuilder.class/instance/build.st +++ b/source/Buoy.package/AssertionCheckerBuilder.class/instance/build.st @@ -1,4 +1,4 @@ checking build - ^ AssertionChecker applying: failurePolicyFactory new to: asserter \ No newline at end of file + ^ AssertionChecker applying: (failurePolicyFactory raising: errorClass) to: asserter \ No newline at end of file diff --git a/source/Buoy.package/AssertionCheckerBuilder.class/instance/initialize.st b/source/Buoy.package/AssertionCheckerBuilder.class/instance/initialize.st index 353137f..fd944b8 100644 --- a/source/Buoy.package/AssertionCheckerBuilder.class/instance/initialize.st +++ b/source/Buoy.package/AssertionCheckerBuilder.class/instance/initialize.st @@ -3,4 +3,5 @@ initialize super initialize. asserter := Asserter new. + errorClass := AssertionFailurePolicy defaultError. failurePolicyFactory := CollectingAssertionFailuresPolicy \ No newline at end of file diff --git a/source/Buoy.package/AssertionCheckerBuilder.class/instance/raising..st b/source/Buoy.package/AssertionCheckerBuilder.class/instance/raising..st new file mode 100644 index 0000000..7886b50 --- /dev/null +++ b/source/Buoy.package/AssertionCheckerBuilder.class/instance/raising..st @@ -0,0 +1,4 @@ +configuring +raising: anErrorClass + + errorClass := anErrorClass \ No newline at end of file diff --git a/source/Buoy.package/AssertionCheckerBuilder.class/methodProperties.json b/source/Buoy.package/AssertionCheckerBuilder.class/methodProperties.json index 11df17a..95b2cc9 100644 --- a/source/Buoy.package/AssertionCheckerBuilder.class/methodProperties.json +++ b/source/Buoy.package/AssertionCheckerBuilder.class/methodProperties.json @@ -1,8 +1,9 @@ { "instance" : { - "build" : "GabrielOmarCotelli 1/25/2017 21:52", + "build" : "GabrielOmarCotelli 1/31/2017 21:04", "checking:" : "GabrielOmarCotelli 1/23/2017 17:14", - "initialize" : "GabrielOmarCotelli 1/24/2017 21:29", + "initialize" : "GabrielOmarCotelli 1/31/2017 21:04", + "raising:" : "GabrielOmarCotelli 1/31/2017 21:05", "buildAndCheck" : "GabrielOmarCotelli 1/25/2017 21:52", "failFast" : "GabrielOmarCotelli 1/24/2017 21:29" }, diff --git a/source/Buoy.package/AssertionCheckerBuilder.class/properties.json b/source/Buoy.package/AssertionCheckerBuilder.class/properties.json index 4ea117e..7bac651 100644 --- a/source/Buoy.package/AssertionCheckerBuilder.class/properties.json +++ b/source/Buoy.package/AssertionCheckerBuilder.class/properties.json @@ -7,7 +7,8 @@ "classvars" : [ ], "instvars" : [ "asserter", - "failurePolicyFactory" + "failurePolicyFactory", + "errorClass" ], "name" : "AssertionCheckerBuilder", "type" : "normal" diff --git a/source/Buoy.package/AssertionFailurePolicy.class/class/defaultError.st b/source/Buoy.package/AssertionFailurePolicy.class/class/defaultError.st new file mode 100644 index 0000000..83949d1 --- /dev/null +++ b/source/Buoy.package/AssertionFailurePolicy.class/class/defaultError.st @@ -0,0 +1,4 @@ +Accessing +defaultError + + ^ AssertionFailed \ No newline at end of file diff --git a/source/Buoy.package/AssertionFailurePolicy.class/class/raising..st b/source/Buoy.package/AssertionFailurePolicy.class/class/raising..st new file mode 100644 index 0000000..12414f8 --- /dev/null +++ b/source/Buoy.package/AssertionFailurePolicy.class/class/raising..st @@ -0,0 +1,4 @@ +Instance Creation +raising: anErrorClass + + ^ self subclassResponsibility \ No newline at end of file diff --git a/source/Buoy.package/AssertionFailurePolicy.class/methodProperties.json b/source/Buoy.package/AssertionFailurePolicy.class/methodProperties.json index 1189623..72d281f 100644 --- a/source/Buoy.package/AssertionFailurePolicy.class/methodProperties.json +++ b/source/Buoy.package/AssertionFailurePolicy.class/methodProperties.json @@ -3,5 +3,8 @@ "applyTo:" : "GabrielOmarCotelli 1/24/2017 21:23", "assertionFailedBecause:" : "GabrielOmarCotelli 1/24/2017 21:27" }, - "class" : { } + "class" : { + "raising:" : "GabrielOmarCotelli 1/31/2017 21:02", + "defaultError" : "GabrielOmarCotelli 1/31/2017 21:01" + } } \ No newline at end of file diff --git a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/class/new.st b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/class/new.st deleted file mode 100644 index 2cd2f06..0000000 --- a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/class/new.st +++ /dev/null @@ -1,4 +0,0 @@ -instance creation -new - - ^ super new initialize \ No newline at end of file diff --git a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/class/raising..st b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/class/raising..st new file mode 100644 index 0000000..60544ef --- /dev/null +++ b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/class/raising..st @@ -0,0 +1,4 @@ +Instance Creation +raising: anErrorClass + + ^ self new initializeRaising: anErrorClass \ No newline at end of file diff --git a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/applyTo..st b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/applyTo..st index a7e8cbe..d0d4276 100644 --- a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/applyTo..st +++ b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/applyTo..st @@ -2,4 +2,4 @@ applying applyTo: anAsserter super applyTo: anAsserter. - failures ifNotEmpty: [ AssertionFailed signalAll: failures ] \ No newline at end of file + failures ifNotEmpty: [ errorClass signalAll: failures ] \ No newline at end of file diff --git a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/initialize.st b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/initialize.st deleted file mode 100644 index ce051fe..0000000 --- a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/initialize.st +++ /dev/null @@ -1,5 +0,0 @@ -initialization -initialize - - super initialize. - failures := OrderedCollection new \ No newline at end of file diff --git a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/initializeRaising..st b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/initializeRaising..st new file mode 100644 index 0000000..7316ee2 --- /dev/null +++ b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/instance/initializeRaising..st @@ -0,0 +1,5 @@ +initialization +initializeRaising: anErrorClass + + errorClass := anErrorClass. + failures := OrderedCollection new \ No newline at end of file diff --git a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/methodProperties.json b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/methodProperties.json index 7a878ff..23790bf 100644 --- a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/methodProperties.json +++ b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/methodProperties.json @@ -1,10 +1,10 @@ { "instance" : { - "initialize" : "GabrielOmarCotelli 1/24/2017 21:20", - "applyTo:" : "GabrielOmarCotelli 1/25/2017 21:29", + "initializeRaising:" : "GabrielOmarCotelli 1/31/2017 21:03", + "applyTo:" : "GabrielOmarCotelli 1/31/2017 21:03", "assertionFailedBecause:" : "GabrielOmarCotelli 1/24/2017 21:28" }, "class" : { - "new" : "GabrielOmarCotelli 1/24/2017 21:20" + "raising:" : "GabrielOmarCotelli 1/31/2017 21:10" } } \ No newline at end of file diff --git a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/properties.json b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/properties.json index bbb0df5..36864ef 100644 --- a/source/Buoy.package/CollectingAssertionFailuresPolicy.class/properties.json +++ b/source/Buoy.package/CollectingAssertionFailuresPolicy.class/properties.json @@ -6,7 +6,8 @@ "pools" : [ ], "classvars" : [ ], "instvars" : [ - "failures" + "failures", + "errorClass" ], "name" : "CollectingAssertionFailuresPolicy", "type" : "normal" diff --git a/source/Buoy.package/InstanceCreationFailed.class/README.md b/source/Buoy.package/InstanceCreationFailed.class/README.md new file mode 100644 index 0000000..aa7be0d --- /dev/null +++ b/source/Buoy.package/InstanceCreationFailed.class/README.md @@ -0,0 +1 @@ +I'm an exception expecting to be raised when someone tries to create an invalid instance \ No newline at end of file diff --git a/source/Buoy.package/InstanceCreationFailed.class/methodProperties.json b/source/Buoy.package/InstanceCreationFailed.class/methodProperties.json new file mode 100644 index 0000000..d158391 --- /dev/null +++ b/source/Buoy.package/InstanceCreationFailed.class/methodProperties.json @@ -0,0 +1,4 @@ +{ + "instance" : { }, + "class" : { } +} \ No newline at end of file diff --git a/source/Buoy.package/InstanceCreationFailed.class/properties.json b/source/Buoy.package/InstanceCreationFailed.class/properties.json new file mode 100644 index 0000000..4d38caf --- /dev/null +++ b/source/Buoy.package/InstanceCreationFailed.class/properties.json @@ -0,0 +1,11 @@ +{ + "commentStamp" : "GabrielOmarCotelli 1/31/2017 20:18", + "super" : "AssertionFailed", + "category" : "Buoy-Assertions", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ ], + "name" : "InstanceCreationFailed", + "type" : "normal" +} \ No newline at end of file diff --git a/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/class/raising..st b/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/class/raising..st new file mode 100644 index 0000000..60544ef --- /dev/null +++ b/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/class/raising..st @@ -0,0 +1,4 @@ +Instance Creation +raising: anErrorClass + + ^ self new initializeRaising: anErrorClass \ No newline at end of file diff --git a/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/instance/assertionFailedBecause..st b/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/instance/assertionFailedBecause..st index d190b4f..561dcc8 100644 --- a/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/instance/assertionFailedBecause..st +++ b/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/instance/assertionFailedBecause..st @@ -1,4 +1,4 @@ notifying assertionFailedBecause: aFailureExplanation - AssertionFailed signal: aFailureExplanation \ No newline at end of file + errorClass signal: aFailureExplanation \ No newline at end of file diff --git a/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/instance/initializeRaising..st b/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/instance/initializeRaising..st new file mode 100644 index 0000000..c78e253 --- /dev/null +++ b/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/instance/initializeRaising..st @@ -0,0 +1,4 @@ +initialization +initializeRaising: anErrorClass + + errorClass := anErrorClass \ No newline at end of file diff --git a/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/methodProperties.json b/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/methodProperties.json index 1da9403..94a973f 100644 --- a/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/methodProperties.json +++ b/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/methodProperties.json @@ -1,6 +1,9 @@ { "instance" : { - "assertionFailedBecause:" : "GabrielOmarCotelli 1/24/2017 21:28" + "initializeRaising:" : "GabrielOmarCotelli 1/31/2017 20:22", + "assertionFailedBecause:" : "GabrielOmarCotelli 1/31/2017 20:22" }, - "class" : { } + "class" : { + "raising:" : "GabrielOmarCotelli 1/31/2017 21:10" + } } \ No newline at end of file diff --git a/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/properties.json b/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/properties.json index bb104b0..26bea58 100644 --- a/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/properties.json +++ b/source/Buoy.package/RaiseOnFirstAssertionFailurePolicy.class/properties.json @@ -5,7 +5,9 @@ "classinstvars" : [ ], "pools" : [ ], "classvars" : [ ], - "instvars" : [ ], + "instvars" : [ + "errorClass" + ], "name" : "RaiseOnFirstAssertionFailurePolicy", "type" : "normal" } \ No newline at end of file diff --git a/source/Buoy.package/monticello.meta/version b/source/Buoy.package/monticello.meta/version index ed516ae..c0727fc 100644 --- a/source/Buoy.package/monticello.meta/version +++ b/source/Buoy.package/monticello.meta/version @@ -1 +1 @@ -(name 'Buoy-GabrielOmarCotelli.3' message 'Add Holders ' id '6abb119b-9bdf-9f4d-9ed6-03e57b808e6f' date '27 January 2017' time '6:46:17.43442 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.2' message 'Renamed a method' id '9695bddd-07f6-4941-9102-6391e123ed81' date '26 January 2017' time '7:51:52.401108 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.1' message 'Renamed packages' id 'cd4412b9-c2d6-4833-aa07-73bfa4f0bd14' date '26 January 2017' time '7:29:12.845086 pm' author 'GabrielOmarCotelli' ancestors () stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Buoy-GabrielOmarCotelli.4' message 'Add support for configuring the error to raise' id 'c7f8a941-2bd9-4516-b799-422568b01d9b' date '31 January 2017' time '9:12:59.929828 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.3' message 'Add Holders ' id '6abb119b-9bdf-9f4d-9ed6-03e57b808e6f' date '27 January 2017' time '6:46:17.43442 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.2' message 'Renamed a method' id '9695bddd-07f6-4941-9102-6391e123ed81' date '26 January 2017' time '7:51:52.401108 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.1' message 'Renamed packages' id 'cd4412b9-c2d6-4833-aa07-73bfa4f0bd14' date '26 January 2017' time '7:29:12.845086 pm' author 'GabrielOmarCotelli' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file From 5831de15fa3861ff851bb41f200b0fc4b4eb9504 Mon Sep 17 00:00:00 2001 From: Gabriel Cotelli Date: Wed, 1 Feb 2017 15:21:47 -0300 Subject: [PATCH 2/2] Minor changes. Added support for refuse:. --- .../instance/testConditionalChecking.st | 2 +- .../testSeveralConditionsButOnlyOneFailed.st | 2 +- .../methodProperties.json | 4 ++-- .../testEnforceOneFactFailingRaisingError.st | 2 +- .../instance/testRefuseOneFactFailing.st | 7 +++++++ .../instance/testRefuseOneFactNotFailing.st | 6 ++++++ .../methodProperties.json | 8 +++++--- source/Buoy-Tests.package/monticello.meta/version | 2 +- .../Asserter.class/instance/asReverseFact..st | 4 ++++ .../Asserter.class/instance/refuse.because..st | 4 ++++ .../instance/refuse.because.onSuccess..st | 4 ++++ .../Asserter.class/methodProperties.json | 7 +++++-- .../checkApplyingFailFastPolicyTo.raising..st | 4 ++++ .../class/enforce.because..st | 2 +- .../class/enforce.because.raising..st | 14 +++++++------- .../class/refuse.because..st | 4 ++++ .../class/refuse.because.raising..st | 9 +++++++++ .../AssertionChecker.class/methodProperties.json | 7 +++++-- .../instance/build.st | 2 +- .../instance/initialize.st | 2 +- .../instance/raising..st | 4 ++-- .../methodProperties.json | 6 +++--- .../AssertionCheckerBuilder.class/properties.json | 2 +- .../{defaultError.st => defaultErrorToSignal.st} | 2 +- .../methodProperties.json | 4 ++-- source/Buoy.package/monticello.meta/version | 2 +- 26 files changed, 83 insertions(+), 33 deletions(-) create mode 100644 source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testRefuseOneFactFailing.st create mode 100644 source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testRefuseOneFactNotFailing.st create mode 100644 source/Buoy.package/Asserter.class/instance/asReverseFact..st create mode 100644 source/Buoy.package/Asserter.class/instance/refuse.because..st create mode 100644 source/Buoy.package/Asserter.class/instance/refuse.because.onSuccess..st create mode 100644 source/Buoy.package/AssertionChecker.class/class/checkApplyingFailFastPolicyTo.raising..st create mode 100644 source/Buoy.package/AssertionChecker.class/class/refuse.because..st create mode 100644 source/Buoy.package/AssertionChecker.class/class/refuse.because.raising..st rename source/Buoy.package/AssertionFailurePolicy.class/class/{defaultError.st => defaultErrorToSignal.st} (58%) diff --git a/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testConditionalChecking.st b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testConditionalChecking.st index b17fda6..ecb88d5 100644 --- a/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testConditionalChecking.st +++ b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testConditionalChecking.st @@ -7,7 +7,7 @@ testConditionalChecking rowCount := -15. checkerBuilder - checking: [ :asserter | asserter enforce: [ rowCount notNil ] because: [ self fail ] onSuccess: [ :successAsserter | successAsserter enforce: [ rowCount positive ] because: [ explanation ] ] ]. + checking: [ :asserter | asserter refuse: [ rowCount isNil ] because: [ self fail ] onSuccess: [ :successAsserter | successAsserter enforce: [ rowCount positive ] because: [ explanation ] ] ]. self should: [ checkerBuilder buildAndCheck ] diff --git a/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testSeveralConditionsButOnlyOneFailed.st b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testSeveralConditionsButOnlyOneFailed.st index d937557..133adf4 100644 --- a/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testSeveralConditionsButOnlyOneFailed.st +++ b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/instance/testSeveralConditionsButOnlyOneFailed.st @@ -9,7 +9,7 @@ testSeveralConditionsButOnlyOneFailed asserter enforce: [ 4 > 3 ] because: [ self fail ]; enforce: [ 1 > 2 ] because: mathFailureExplanation; - enforce: [ #() isEmpty ] because: [ self fail ] ]. + refuse: [ #() notEmpty ] because: [ self fail ] ]. self should: [ checkerBuilder buildAndCheck ] raise: AssertionFailed diff --git a/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/methodProperties.json b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/methodProperties.json index 5b95814..3f64ab4 100644 --- a/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/methodProperties.json +++ b/source/Buoy-Tests.package/AssertionCheckerBuilderTest.class/methodProperties.json @@ -1,11 +1,11 @@ { "instance" : { "testWithoutFailures" : "GabrielOmarCotelli 1/26/2017 19:50", - "testConditionalChecking" : "GabrielOmarCotelli 1/26/2017 19:50", + "testConditionalChecking" : "GabrielOmarCotelli 2/1/2017 15:10", "testSeveralConditionsButOnlyOneFailedConfiguringErrorToRaise" : "GabrielOmarCotelli 1/31/2017 21:06", "testFailFastConfiguringErrorToRaise" : "GabrielOmarCotelli 1/31/2017 21:06", "testConditionalCheckingWhenFirstConditionFails" : "GabrielOmarCotelli 1/26/2017 19:50", - "testSeveralConditionsButOnlyOneFailed" : "GabrielOmarCotelli 1/26/2017 19:50", + "testSeveralConditionsButOnlyOneFailed" : "GabrielOmarCotelli 2/1/2017 15:10", "testSingleConditionFailure" : "GabrielOmarCotelli 1/26/2017 19:50", "testFailFastPassingSomeConditions" : "GabrielOmarCotelli 1/26/2017 19:50", "testFailFastInConditional" : "GabrielOmarCotelli 1/26/2017 19:50", diff --git a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingError.st b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingError.st index 01964a3..0245e06 100644 --- a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingError.st +++ b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testEnforceOneFactFailingRaisingError.st @@ -4,5 +4,5 @@ testEnforceOneFactFailingRaisingError | explanation | explanation := 'A false statement'. - "For single fact checking any exception can be configured to be raised" + "For single fact checking any exception can be configured to be raised, but it's not the case when using multiple fact checking" self should: [ AssertionChecker enforce: [ false ] because: explanation raising: Error ] raise: Error withExceptionDo: [ :exception | self assert: exception messageText equals: explanation ] \ No newline at end of file diff --git a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testRefuseOneFactFailing.st b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testRefuseOneFactFailing.st new file mode 100644 index 0000000..5097523 --- /dev/null +++ b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testRefuseOneFactFailing.st @@ -0,0 +1,7 @@ +tests +testRefuseOneFactFailing + + | explanation | + + explanation := 'A false statement'. + self should: [ AssertionChecker refuse: [ true ] because: explanation ] raise: AssertionFailed withExceptionDo: [ :exception | self assert: exception messageText equals: explanation ] \ No newline at end of file diff --git a/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testRefuseOneFactNotFailing.st b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testRefuseOneFactNotFailing.st new file mode 100644 index 0000000..f0545fb --- /dev/null +++ b/source/Buoy-Tests.package/AssertionCheckerTest.class/instance/testRefuseOneFactNotFailing.st @@ -0,0 +1,6 @@ +tests +testRefuseOneFactNotFailing + + self + shouldnt: [ AssertionChecker refuse: [ false ] because: [ self fail ] ] raise: AssertionFailed; + shouldnt: [ AssertionChecker refuse: [ false ] because: [ self fail ] raising: InstanceCreationFailed ] raise: InstanceCreationFailed \ No newline at end of file diff --git a/source/Buoy-Tests.package/AssertionCheckerTest.class/methodProperties.json b/source/Buoy-Tests.package/AssertionCheckerTest.class/methodProperties.json index cb4693e..f442098 100644 --- a/source/Buoy-Tests.package/AssertionCheckerTest.class/methodProperties.json +++ b/source/Buoy-Tests.package/AssertionCheckerTest.class/methodProperties.json @@ -1,9 +1,11 @@ { "instance" : { - "testEnforceOneFactFailingRaisingNonDefaultException" : "GabrielOmarCotelli 1/31/2017 20:19", - "testEnforceOneFactFailing" : "GabrielOmarCotelli 1/31/2017 20:16", "testEnforceOneFactNotFailing" : "GabrielOmarCotelli 1/31/2017 20:57", - "testEnforceOneFactFailingRaisingError" : "GabrielOmarCotelli 1/31/2017 21:08" + "testRefuseOneFactFailing" : "GabrielOmarCotelli 2/1/2017 14:49", + "testEnforceOneFactFailing" : "GabrielOmarCotelli 1/31/2017 20:16", + "testRefuseOneFactNotFailing" : "GabrielOmarCotelli 2/1/2017 15:08", + "testEnforceOneFactFailingRaisingError" : "GabrielOmarCotelli 2/1/2017 14:22", + "testEnforceOneFactFailingRaisingNonDefaultException" : "GabrielOmarCotelli 1/31/2017 20:19" }, "class" : { } } \ No newline at end of file diff --git a/source/Buoy-Tests.package/monticello.meta/version b/source/Buoy-Tests.package/monticello.meta/version index c0e6705..75a259b 100644 --- a/source/Buoy-Tests.package/monticello.meta/version +++ b/source/Buoy-Tests.package/monticello.meta/version @@ -1 +1 @@ -(name 'Buoy-Tests-GabrielOmarCotelli.4' message 'Add test cases' id 'eebeab3b-1eda-4b0c-955e-450bc100b05a' date '31 January 2017' time '9:13:55.838186 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.3' message 'Add Holders ' id '21414a7c-6b1d-134d-a01a-dad169c438de' date '27 January 2017' time '6:47:13.88642 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.2' message 'Renamed a method' id '4db25a31-cdbf-4d66-8e72-877e298b1b47' date '26 January 2017' time '7:51:46.200684 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.1' message 'Renamed packages' id '714b9a68-e0b3-4b48-be06-7b3f27f4ce47' date '26 January 2017' time '7:29:43.673983 pm' author 'GabrielOmarCotelli' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Buoy-Tests-GabrielOmarCotelli.5' message 'Minor changes. Added support for refuse:.' id '76d04fb8-d53c-2348-b0b9-e090961b922e' date '1 February 2017' time '3:16:33.360533 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.4' message 'Add test cases' id 'eebeab3b-1eda-4b0c-955e-450bc100b05a' date '31 January 2017' time '9:13:55.838186 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.3' message 'Add Holders ' id '21414a7c-6b1d-134d-a01a-dad169c438de' date '27 January 2017' time '6:47:13.88642 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.2' message 'Renamed a method' id '4db25a31-cdbf-4d66-8e72-877e298b1b47' date '26 January 2017' time '7:51:46.200684 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-Tests-GabrielOmarCotelli.1' message 'Renamed packages' id '714b9a68-e0b3-4b48-be06-7b3f27f4ce47' date '26 January 2017' time '7:29:43.673983 pm' author 'GabrielOmarCotelli' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file diff --git a/source/Buoy.package/Asserter.class/instance/asReverseFact..st b/source/Buoy.package/Asserter.class/instance/asReverseFact..st new file mode 100644 index 0000000..0acbb15 --- /dev/null +++ b/source/Buoy.package/Asserter.class/instance/asReverseFact..st @@ -0,0 +1,4 @@ +private +asReverseFact: aFact + + ^ [ aFact value not ] \ No newline at end of file diff --git a/source/Buoy.package/Asserter.class/instance/refuse.because..st b/source/Buoy.package/Asserter.class/instance/refuse.because..st new file mode 100644 index 0000000..3111cf7 --- /dev/null +++ b/source/Buoy.package/Asserter.class/instance/refuse.because..st @@ -0,0 +1,4 @@ +configuring +refuse: aFact because: aStringOrBlock + + self enforce: (self asReverseFact: aFact) because: aStringOrBlock \ No newline at end of file diff --git a/source/Buoy.package/Asserter.class/instance/refuse.because.onSuccess..st b/source/Buoy.package/Asserter.class/instance/refuse.because.onSuccess..st new file mode 100644 index 0000000..56c9418 --- /dev/null +++ b/source/Buoy.package/Asserter.class/instance/refuse.because.onSuccess..st @@ -0,0 +1,4 @@ +configuring +refuse: aFact because: anExplanationStringOrBlock onSuccess: aSuccessAction + + self enforce: (self asReverseFact: aFact) because: anExplanationStringOrBlock onSuccess: aSuccessAction \ No newline at end of file diff --git a/source/Buoy.package/Asserter.class/methodProperties.json b/source/Buoy.package/Asserter.class/methodProperties.json index 6275f0a..e38ae16 100644 --- a/source/Buoy.package/Asserter.class/methodProperties.json +++ b/source/Buoy.package/Asserter.class/methodProperties.json @@ -1,10 +1,13 @@ { "instance" : { + "asReverseFact:" : "GabrielOmarCotelli 2/1/2017 14:44", "enforce:because:" : "GabrielOmarCotelli 1/26/2017 19:50", "enforce:because:onSuccess:" : "GabrielOmarCotelli 1/26/2017 19:50", - "initialize" : "GabrielOmarCotelli 1/25/2017 21:42", "checkApplying:" : "GabrielOmarCotelli 1/25/2017 21:43", - "value:applying:" : "GabrielOmarCotelli 1/24/2017 21:46" + "initialize" : "GabrielOmarCotelli 1/25/2017 21:42", + "value:applying:" : "GabrielOmarCotelli 1/24/2017 21:46", + "refuse:because:onSuccess:" : "GabrielOmarCotelli 2/1/2017 14:44", + "refuse:because:" : "GabrielOmarCotelli 2/1/2017 14:44" }, "class" : { } } \ No newline at end of file diff --git a/source/Buoy.package/AssertionChecker.class/class/checkApplyingFailFastPolicyTo.raising..st b/source/Buoy.package/AssertionChecker.class/class/checkApplyingFailFastPolicyTo.raising..st new file mode 100644 index 0000000..838170a --- /dev/null +++ b/source/Buoy.package/AssertionChecker.class/class/checkApplyingFailFastPolicyTo.raising..st @@ -0,0 +1,4 @@ +private +checkApplyingFailFastPolicyTo: asserter raising: errorToSignal + + ^ (self applying: (RaiseOnFirstAssertionFailurePolicy raising: errorToSignal) to: asserter) check \ No newline at end of file diff --git a/source/Buoy.package/AssertionChecker.class/class/enforce.because..st b/source/Buoy.package/AssertionChecker.class/class/enforce.because..st index f634631..b37a2a9 100644 --- a/source/Buoy.package/AssertionChecker.class/class/enforce.because..st +++ b/source/Buoy.package/AssertionChecker.class/class/enforce.because..st @@ -1,4 +1,4 @@ checking enforce: aFact because: aStringOrBlockExplanation - ^ self enforce: aFact because: aStringOrBlockExplanation raising: AssertionFailed \ No newline at end of file + ^ self enforce: aFact because: aStringOrBlockExplanation raising: AssertionFailurePolicy defaultErrorToSignal \ No newline at end of file diff --git a/source/Buoy.package/AssertionChecker.class/class/enforce.because.raising..st b/source/Buoy.package/AssertionChecker.class/class/enforce.because.raising..st index 54ec984..395e387 100644 --- a/source/Buoy.package/AssertionChecker.class/class/enforce.because.raising..st +++ b/source/Buoy.package/AssertionChecker.class/class/enforce.because.raising..st @@ -1,9 +1,9 @@ checking -enforce: aFact because: aStringOrBlockExplanation raising: errorClass +enforce: aFact because: aStringOrBlockExplanation raising: errorToSignal - ^ (self - applying: (RaiseOnFirstAssertionFailurePolicy raising: errorClass) - to: - (Asserter new - enforce: aFact because: aStringOrBlockExplanation; - yourself)) check \ No newline at end of file + | asserter | + + asserter := Asserter new. + asserter enforce: aFact because: aStringOrBlockExplanation. + + ^ self checkApplyingFailFastPolicyTo: asserter raising: errorToSignal \ No newline at end of file diff --git a/source/Buoy.package/AssertionChecker.class/class/refuse.because..st b/source/Buoy.package/AssertionChecker.class/class/refuse.because..st new file mode 100644 index 0000000..2f5c7ad --- /dev/null +++ b/source/Buoy.package/AssertionChecker.class/class/refuse.because..st @@ -0,0 +1,4 @@ +checking +refuse: aFact because: aStringOrBlockExplanation + + ^ self refuse: aFact because: aStringOrBlockExplanation raising: AssertionFailurePolicy defaultErrorToSignal \ No newline at end of file diff --git a/source/Buoy.package/AssertionChecker.class/class/refuse.because.raising..st b/source/Buoy.package/AssertionChecker.class/class/refuse.because.raising..st new file mode 100644 index 0000000..ca859a7 --- /dev/null +++ b/source/Buoy.package/AssertionChecker.class/class/refuse.because.raising..st @@ -0,0 +1,9 @@ +checking +refuse: aFact because: aStringOrBlockExplanation raising: errorToSignal + + | asserter | + + asserter := Asserter new. + asserter refuse: aFact because: aStringOrBlockExplanation. + + ^ self checkApplyingFailFastPolicyTo: asserter raising: errorToSignal \ No newline at end of file diff --git a/source/Buoy.package/AssertionChecker.class/methodProperties.json b/source/Buoy.package/AssertionChecker.class/methodProperties.json index 594be10..0bc4a13 100644 --- a/source/Buoy.package/AssertionChecker.class/methodProperties.json +++ b/source/Buoy.package/AssertionChecker.class/methodProperties.json @@ -4,8 +4,11 @@ "check" : "GabrielOmarCotelli 1/25/2017 21:50" }, "class" : { + "enforce:because:" : "GabrielOmarCotelli 2/1/2017 14:09", + "checkApplyingFailFastPolicyTo:raising:" : "GabrielOmarCotelli 2/1/2017 14:48", + "enforce:because:raising:" : "GabrielOmarCotelli 2/1/2017 14:48", + "refuse:because:raising:" : "GabrielOmarCotelli 2/1/2017 14:47", "applying:to:" : "GabrielOmarCotelli 1/25/2017 21:51", - "enforce:because:" : "GabrielOmarCotelli 1/31/2017 20:55", - "enforce:because:raising:" : "GabrielOmarCotelli 1/31/2017 20:55" + "refuse:because:" : "GabrielOmarCotelli 2/1/2017 14:45" } } \ No newline at end of file diff --git a/source/Buoy.package/AssertionCheckerBuilder.class/instance/build.st b/source/Buoy.package/AssertionCheckerBuilder.class/instance/build.st index a67eb41..a9c6f68 100644 --- a/source/Buoy.package/AssertionCheckerBuilder.class/instance/build.st +++ b/source/Buoy.package/AssertionCheckerBuilder.class/instance/build.st @@ -1,4 +1,4 @@ checking build - ^ AssertionChecker applying: (failurePolicyFactory raising: errorClass) to: asserter \ No newline at end of file + ^ AssertionChecker applying: (failurePolicyFactory raising: errorToSignal) to: asserter \ No newline at end of file diff --git a/source/Buoy.package/AssertionCheckerBuilder.class/instance/initialize.st b/source/Buoy.package/AssertionCheckerBuilder.class/instance/initialize.st index fd944b8..db3df42 100644 --- a/source/Buoy.package/AssertionCheckerBuilder.class/instance/initialize.st +++ b/source/Buoy.package/AssertionCheckerBuilder.class/instance/initialize.st @@ -3,5 +3,5 @@ initialize super initialize. asserter := Asserter new. - errorClass := AssertionFailurePolicy defaultError. + self raising: AssertionFailurePolicy defaultErrorToSignal. failurePolicyFactory := CollectingAssertionFailuresPolicy \ No newline at end of file diff --git a/source/Buoy.package/AssertionCheckerBuilder.class/instance/raising..st b/source/Buoy.package/AssertionCheckerBuilder.class/instance/raising..st index 7886b50..25d611a 100644 --- a/source/Buoy.package/AssertionCheckerBuilder.class/instance/raising..st +++ b/source/Buoy.package/AssertionCheckerBuilder.class/instance/raising..st @@ -1,4 +1,4 @@ configuring -raising: anErrorClass +raising: anErrorToSignal - errorClass := anErrorClass \ No newline at end of file + errorToSignal := anErrorToSignal \ No newline at end of file diff --git a/source/Buoy.package/AssertionCheckerBuilder.class/methodProperties.json b/source/Buoy.package/AssertionCheckerBuilder.class/methodProperties.json index 95b2cc9..fe568c3 100644 --- a/source/Buoy.package/AssertionCheckerBuilder.class/methodProperties.json +++ b/source/Buoy.package/AssertionCheckerBuilder.class/methodProperties.json @@ -1,9 +1,9 @@ { "instance" : { - "build" : "GabrielOmarCotelli 1/31/2017 21:04", + "build" : "GabrielOmarCotelli 2/1/2017 14:11", "checking:" : "GabrielOmarCotelli 1/23/2017 17:14", - "initialize" : "GabrielOmarCotelli 1/31/2017 21:04", - "raising:" : "GabrielOmarCotelli 1/31/2017 21:05", + "initialize" : "GabrielOmarCotelli 2/1/2017 14:11", + "raising:" : "GabrielOmarCotelli 2/1/2017 14:11", "buildAndCheck" : "GabrielOmarCotelli 1/25/2017 21:52", "failFast" : "GabrielOmarCotelli 1/24/2017 21:29" }, diff --git a/source/Buoy.package/AssertionCheckerBuilder.class/properties.json b/source/Buoy.package/AssertionCheckerBuilder.class/properties.json index 7bac651..a51babd 100644 --- a/source/Buoy.package/AssertionCheckerBuilder.class/properties.json +++ b/source/Buoy.package/AssertionCheckerBuilder.class/properties.json @@ -8,7 +8,7 @@ "instvars" : [ "asserter", "failurePolicyFactory", - "errorClass" + "errorToSignal" ], "name" : "AssertionCheckerBuilder", "type" : "normal" diff --git a/source/Buoy.package/AssertionFailurePolicy.class/class/defaultError.st b/source/Buoy.package/AssertionFailurePolicy.class/class/defaultErrorToSignal.st similarity index 58% rename from source/Buoy.package/AssertionFailurePolicy.class/class/defaultError.st rename to source/Buoy.package/AssertionFailurePolicy.class/class/defaultErrorToSignal.st index 83949d1..67a64a0 100644 --- a/source/Buoy.package/AssertionFailurePolicy.class/class/defaultError.st +++ b/source/Buoy.package/AssertionFailurePolicy.class/class/defaultErrorToSignal.st @@ -1,4 +1,4 @@ Accessing -defaultError +defaultErrorToSignal ^ AssertionFailed \ No newline at end of file diff --git a/source/Buoy.package/AssertionFailurePolicy.class/methodProperties.json b/source/Buoy.package/AssertionFailurePolicy.class/methodProperties.json index 72d281f..133b7ef 100644 --- a/source/Buoy.package/AssertionFailurePolicy.class/methodProperties.json +++ b/source/Buoy.package/AssertionFailurePolicy.class/methodProperties.json @@ -4,7 +4,7 @@ "assertionFailedBecause:" : "GabrielOmarCotelli 1/24/2017 21:27" }, "class" : { - "raising:" : "GabrielOmarCotelli 1/31/2017 21:02", - "defaultError" : "GabrielOmarCotelli 1/31/2017 21:01" + "defaultErrorToSignal" : "GabrielOmarCotelli 2/1/2017 14:09", + "raising:" : "GabrielOmarCotelli 1/31/2017 21:02" } } \ No newline at end of file diff --git a/source/Buoy.package/monticello.meta/version b/source/Buoy.package/monticello.meta/version index c0727fc..c590224 100644 --- a/source/Buoy.package/monticello.meta/version +++ b/source/Buoy.package/monticello.meta/version @@ -1 +1 @@ -(name 'Buoy-GabrielOmarCotelli.4' message 'Add support for configuring the error to raise' id 'c7f8a941-2bd9-4516-b799-422568b01d9b' date '31 January 2017' time '9:12:59.929828 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.3' message 'Add Holders ' id '6abb119b-9bdf-9f4d-9ed6-03e57b808e6f' date '27 January 2017' time '6:46:17.43442 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.2' message 'Renamed a method' id '9695bddd-07f6-4941-9102-6391e123ed81' date '26 January 2017' time '7:51:52.401108 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.1' message 'Renamed packages' id 'cd4412b9-c2d6-4833-aa07-73bfa4f0bd14' date '26 January 2017' time '7:29:12.845086 pm' author 'GabrielOmarCotelli' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file +(name 'Buoy-GabrielOmarCotelli.5' message 'Minor changes. Added support for refuse:.' id '90f1c3f8-f68d-384b-bde2-76191df27929' date '1 February 2017' time '3:15:21.893533 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.4' message 'Add support for configuring the error to raise' id 'c7f8a941-2bd9-4516-b799-422568b01d9b' date '31 January 2017' time '9:12:59.929828 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.3' message 'Add Holders ' id '6abb119b-9bdf-9f4d-9ed6-03e57b808e6f' date '27 January 2017' time '6:46:17.43442 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.2' message 'Renamed a method' id '9695bddd-07f6-4941-9102-6391e123ed81' date '26 January 2017' time '7:51:52.401108 pm' author 'GabrielOmarCotelli' ancestors ((name 'Buoy-GabrielOmarCotelli.1' message 'Renamed packages' id 'cd4412b9-c2d6-4833-aa07-73bfa4f0bd14' date '26 January 2017' time '7:29:12.845086 pm' author 'GabrielOmarCotelli' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ()) \ No newline at end of file