home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (AbstractElementFactoryTest.java)

This example Java source code file (AbstractElementFactoryTest.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

abstractelementfactory, abstractelementfactorytest, before, exception, test, vocabword

The AbstractElementFactoryTest.java Java example source code

package org.deeplearning4j.models.sequencevectors.serialization;

import org.deeplearning4j.models.word2vec.VocabWord;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * @author raver119@gmail.com
 */
public class AbstractElementFactoryTest {

    @Before
    public void setUp() throws Exception {

    }

    @Test
    public void testDeserialize() throws Exception {
        VocabWord word = new VocabWord(1, "word");
        AbstractElementFactory<VocabWord> factory = new AbstractElementFactory<>(VocabWord.class);

        System.out.println("VocabWord JSON: " + word.toJSON());

        VocabWord word2 = factory.deserialize(word.toJSON());


        assertEquals(word, word2);
    }

    @Test
    public void testSerialize() throws Exception {
        VocabWord word = new VocabWord(1, "word");
        AbstractElementFactory<VocabWord> factory = new AbstractElementFactory<>(VocabWord.class);

        System.out.println("VocabWord JSON: " + factory.serialize(word));

        VocabWord word2 = factory.deserialize(factory.serialize(word));


        assertEquals(word, word2);
    }
}

Other Java examples (source code examples)

Here is a short list of links related to this Java AbstractElementFactoryTest.java source code file:



my book on functional programming

 

new blog posts

 

Copyright 1998-2019 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.