package votorola.a.diff.harvest.cache; // Copyright 2012. Christian Weilbach. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE. import votorola.a.VoteServer; import votorola.a.diff.DraftPair; import votorola.a.diff.harvest.Message; import votorola.a.diff.harvest.cache.DiffMessage; import java.io.IOException; import java.net.URISyntaxException; import java.sql.SQLException; import java.util.LinkedList; import java.util.Date; import javax.script.ScriptException; import javax.xml.stream.XMLStreamException; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; /** * Unit test for DiffMessage. */ public class DiffMessageTest { private volatile DraftPair dPair; @Before public void setup() throws IOException, ScriptException, SQLException, URISyntaxException, XMLStreamException { final VoteServer.Run vsr = new VoteServer( System.getProperty("user.name")).new Run(false); assert (vsr.database() != null); // error dPair = DraftPair.newDraftPair( 5270, -1, 5284, -1, vsr.voteServer()); } /** * Test setter and getters. * @throws XMLStreamException * @throws IOException */ @Test public void testSettersAndGetters() throws IOException, XMLStreamException { final Date now = new Date(); final Message msg = Message.create( "Summary", "Sender", "http://base.url/", "http://some.url", new LinkedList() , now ); final DiffMessage dmsg = new DiffMessage( msg, dPair ); assertEquals( dmsg.draftPair(), dPair ); } }