Search code examples
oopsmalltalktraitspharotestcase

getting 'ObsoleteTrait' when adding a trait in a testCase


I'm having a problem.

I'm using a code in a testCase It starts like this

|mapeos obj myClass|

myClass := Smalltalk at: #ClaseForTesting.

myClass addToComposition: TraitPruebaCondicion1.

the #ClaseForTesting is an emptyClass

when smalltalk do

myClass addToComposition: TraitPruebaCondicion1

if I (Debugging) try to get the traits

myClass traits 

I'm getting

an OrderedCollection(AnObsoleteTraitPruebaCondicion1)

why is adding AnObsolete in the string trait name? If I run the same code in workspace, it works really fine.

Why is this happening? any ideas? Please, its urgent :(


Solution

  • I can't believe that I was stuck with this a lot of time, and then when I FINALLY decided to ask to the people, I've solve it in two minutes. Shame on me. It must be some kind of mystical brainstorming with this site.

    Anyway, the clue was to using

    Smalltalk at: #
    

    with the trait too! (I was only using it on the class)

    so

    myClass addToComposition:(Smalltalk at: #TraitPruebaCondicion1).
    

    solve my problem.