Skip to content

Commit

Permalink
Added tests to check behavior when storing repeated elements
Browse files Browse the repository at this point in the history
  • Loading branch information
mtabacman committed Jan 5, 2024
1 parent fa5224b commit 630b9f0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions source/Sagan-Core-Tests/RepositoryBasedTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,38 @@ RepositoryBasedTest >> testStore [
else: [ self fail ]
]

{ #category : 'tests - conflict checking' }
RepositoryBasedTest >> testStoreIdentical [

| found instance |

self setUpRepositoryWithNoConflictChecking.
instance := self silvesterStallone.
self extraterrestrials store: instance.
self extraterrestrials store: instance.

found := self extraterrestrials findAll.
self assert: found size equals: 2.
self assert: ( found allSatisfy: [ :extraterrestrial |
extraterrestrial firstName = 'Silvester' and: [ extraterrestrial lastName = 'Stallone' ] ] )
]

{ #category : 'tests - conflict checking' }
RepositoryBasedTest >> testStoreRepeated [

| found |

self setUpRepositoryWithNoConflictChecking.

self extraterrestrials store: self silvesterStallone.
self extraterrestrials store: self silvesterStallone.

found := self extraterrestrials findAll.
self assert: found size equals: 2.
self assert: ( found allSatisfy: [ :extraterrestrial |
extraterrestrial firstName = 'Silvester' and: [ extraterrestrial lastName = 'Stallone' ] ] )
]

{ #category : 'tests - conflict checking' }
RepositoryBasedTest >> testStoreWithConflict [

Expand Down
2 changes: 1 addition & 1 deletion source/Sagan-GemStone/GemStoneRepository.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ GemStoneRepository >> findAllMatching: aCriteriaOrBlock sortedBy: aSortFunction
GemStoneRepository >> initializeCheckingConflictsAccordingTo: aConflictCheckingStrategy [

conflictCheckingStrategy := aConflictCheckingStrategy.
contents := Bag new
contents := Set new
]

{ #category : 'private - accessing' }
Expand Down

0 comments on commit 630b9f0

Please sign in to comment.