Package org.lightfish.business.heartbeat.control

Source Code of org.lightfish.business.heartbeat.control.SerializerTest

package org.lightfish.business.heartbeat.control;

import java.io.StringWriter;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.lightfish.business.servermonitoring.entity.Snapshot;

/**
*
* @author Adam Bien <blog.adam-bien.com>
*/
public class SerializerTest {
   
    Serializer serializer;

    @Before
    public void initialize(){
        this.serializer = new Serializer();
        this.serializer.initialize();
    }
   
    @Test
    public void serialize() {
      Snapshot snapshot = new Snapshot.Builder().usedHeapSize(42).build();
      StringWriter writer = new StringWriter();
      this.serializer.serialize(snapshot, writer);
      String serializedRepresentation = writer.getBuffer().toString();
      assertNotNull(serializedRepresentation);
      assertTrue(serializedRepresentation.contains("42"));
    }


}
TOP

Related Classes of org.lightfish.business.heartbeat.control.SerializerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.