-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
46 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 16 additions & 1 deletion
17
src/test/scala/com/github/fluency03/blockchain/misc/SerdeTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
package com.github.fluency03.blockchain.misc | ||
|
||
import java.io.NotSerializableException | ||
|
||
import org.scalatest.{FlatSpec, Matchers} | ||
|
||
class SerdeTest extends FlatSpec with Matchers { | ||
case class Obj1() extends Serializable | ||
case class Obj2() | ||
|
||
class Obj3() extends Serializable | ||
class Obj4() | ||
|
||
class SerdeTest extends FlatSpec with Matchers { | ||
|
||
"Serde" should "serialize an object and deserialize it." in { | ||
Serde.deserialize[String](Serde.serialize("abc")) shouldEqual "abc" | ||
Serde.deserialize[Int](Serde.serialize(123)) shouldEqual 123 | ||
Serde.deserialize[Obj1](Serde.serialize(Obj1())) shouldEqual Obj1() | ||
Serde.deserialize[Obj2](Serde.serialize(Obj2())) shouldEqual Obj2() | ||
Serde.deserialize[Obj3](Serde.serialize(new Obj3)) shouldBe an[Obj3] | ||
a[NotSerializableException] should be thrownBy Serde.serialize(new Obj4()) | ||
} | ||
|
||
} |