Skip to content

Instantly share code, notes, and snippets.

@pilosus
Created October 3, 2016 12:51
Show Gist options
  • Select an option

  • Save pilosus/6164da03b6f3831be0414e07048dda5b to your computer and use it in GitHub Desktop.

Select an option

Save pilosus/6164da03b6f3831be0414e07048dda5b to your computer and use it in GitHub Desktop.
Stepic Java Basics MOOC. Step 5.4.8 unit-test
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