Created
October 3, 2016 12:51
-
-
Save pilosus/6164da03b6f3831be0414e07048dda5b to your computer and use it in GitHub Desktop.
Stepic Java Basics MOOC. Step 5.4.8 unit-test
This file contains hidden or 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
| package org.stepic.java.module5.animalSerialization; | |
| import org.junit.Test; | |
| import static org.junit.Assert.*; | |
| /** | |
| * Created by vitaly on 03/10/16. | |
| */ | |
| public class AnimalTest { | |
| @Test | |
| public void deserializeAnimalArray() throws Exception { | |
| Animal[] inputAnimals = new Animal[3]; | |
| inputAnimals[0] = new Animal("Dog"); | |
| inputAnimals[1] = new Animal("Cat"); | |
| inputAnimals[2] = new Animal("Cow"); | |
| Animal[] deserializedAnimals = Animal.deserializeAnimalArray( | |
| Animal.serializeAnimalObjects(inputAnimals.length, inputAnimals)); | |
| for (int i = 0; i < deserializedAnimals.length; i++) { | |
| assertEquals(deserializedAnimals[i], inputAnimals[i]); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment