Merge remote-tracking branch 'remotes/origin/splitIntoTwoModules' into NetworkedVisualiser

# Conflicts:
#	visualiser/src/main/java/seng302/VisualiserInput.java
This commit is contained in:
cbt24
2017-05-01 15:55:19 +12:00
8 changed files with 573 additions and 34 deletions
@@ -31,7 +31,7 @@ public class BoatsXMLTest {
inputParticipants.put(420, new StreamedBoat(420));
boatXMLReader.setParticipants(inputParticipants);
boatXMLReader.read();
assertEquals(boatXMLReader.getStreamedBoatMap().size(), 0);
assertEquals(boatXMLReader.getBoats().size(), 0);
}
@Test
@@ -40,6 +40,8 @@ public class BoatsXMLTest {
inputParticipants.put(101, new StreamedBoat(101));
boatXMLReader.setParticipants(inputParticipants);
boatXMLReader.read();
assertTrue(boatXMLReader.getStreamedBoatMap().containsKey(101));
assertEquals(boatXMLReader.getBoats().size(), 1);
StreamedBoat boat = (StreamedBoat) boatXMLReader.getBoats().get(0);
assertEquals(boat.getSourceID(), 101);
}
}
@@ -0,0 +1,39 @@
package seng302.Mock;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Created by jjg64 on 1/05/17.
*/
public class FailBoatXMLTest {
String path = "mockXML/boatXML/";
@Test(expected = SAXException.class)
public void emptyFile() throws SAXException, ParserConfigurationException, ParseException, IOException {
new BoatXMLReader("empty.xml");
}
@Test(expected = NumberFormatException.class)
public void invalidSourceID() throws SAXException, ParserConfigurationException, ParseException, IOException {
new BoatXMLReader(path + "invalidSourceID.xml");
}
@Test(expected = NullPointerException.class)
public void insufficientInformation() throws SAXException, ParserConfigurationException, ParseException, IOException {
new BoatXMLReader(path + "insufficientInformation.xml");
}
}