SerializationMock

android_TUD
Erstie
Erstie
Beiträge: 12
Registriert: 26. Mär 2013 17:48

SerializationMock

Beitrag von android_TUD »

Hi all,
I have been testing all tests, but eclipse and sbt have been detecting some error in 3 test files: MemoryAndTimeTest, PastComparisonTest, TimeEvaluationTest

-Description Resource Path Location Type
method serialize overrides nothing. Note: the super classes of trait MockTestSerializer contain the following, non final members named serialize: def serialize(name: String,value: Long,unit: String): Unit MemoryAndTimeTest.scala /ex02/src/test/scala/ex02 line 11 Scala Problem
-Description Resource Path Location Type
overriding method deserialize in trait Serializer of type (name: String)List[(java.util.Date, Long, String)]; method deserialize has incompatible type MemoryAndTimeTest.scala /ex02/src/test/scala/ex02 line 15 Scala Problem
etc.
Can anyone help me?
Thank you in advance
Tud

ManuelWeiel
Mausschubser
Mausschubser
Beiträge: 72
Registriert: 7. Okt 2014 11:38

Re: SerializationMock

Beitrag von ManuelWeiel »

On a first look, I would say, that you changed the signatures of serialize and deserialize in the Serializer trait, which you should avoid.

android_TUD
Erstie
Erstie
Beiträge: 12
Registriert: 26. Mär 2013 17:48

Re: SerializationMock

Beitrag von android_TUD »

Hi ManuelWeiel,
i think that i don't change anything of the signatures of serialize and deserialize in the Serializer trait. For all traits in PerfSpec.scala i can override and implement these two methods.

ManuelWeiel
Mausschubser
Mausschubser
Beiträge: 72
Registriert: 7. Okt 2014 11:38

Re: SerializationMock

Beitrag von ManuelWeiel »

Please DM me your implementation of your trait Serializer.

ManuelWeiel
Mausschubser
Mausschubser
Beiträge: 72
Registriert: 7. Okt 2014 11:38

Re: SerializationMock

Beitrag von ManuelWeiel »

Looking at your current implementation, the issue is really the type signature of the serialize and deserialize methods.

In your case the problem is more subtle though. You import

Code: Alles auswählen

import java.lang.Long
. Without importing this, will default to the Scala version of a long. By using your import, you force to use the Java version of long.
As the tests use the Scala version in the signatures and your PerSpec.scala uses the Java version, the type signatures do not match.

I'd advise to stick with the Scala version of Long.

Hint: to Parse a long from and String you can use the method toLong.

android_TUD
Erstie
Erstie
Beiträge: 12
Registriert: 26. Mär 2013 17:48

Re: SerializationMock

Beitrag von android_TUD »

Oh, this is my mistake.I should remember this point. Many thanks for your help :)

Antworten

Zurück zu „Archiv“