package ModelTest;

import javax.xml.bind.JAXBException;

import static org.junit.Assert.*;

import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.RunningAgentModel;
import org.junit.Test;

public class MarshallerTest {
	@Test
	public void testMarshal() throws ClassNotFoundException, JAXBException {
		RunningAgentModel runningAgentModel = new RunningAgentModel();
		String contentString = MarshalHelper.marshal(RunningAgentModel.class,
				runningAgentModel);
		assertNotNull(contentString);
		System.out.println(contentString);
	}

	@Test
	public void testUnmarshal() throws JAXBException {
		RunningAgentModel input = new RunningAgentModel();
		String content = MarshalHelper.marshal(RunningAgentModel.class, input);
		RunningAgentModel output = (RunningAgentModel) MarshalHelper.unmarshal(
				RunningAgentModel.class, content);
		System.out.println(input.getLoadInUse());
		assertTrue(input.getLoadInUse() == output.getLoadInUse());
	}

}
