@Test(expected = CoordinateNotFoundOnPlatformException.class) public void testAddProbesWithInvalidCoordinate() throws CoordinateNotFoundOnPlatformException { SpaceProbe probe1 = createProbe(Coordinate.createCoordinate(1, 2)); SpaceProbe probe2 = createProbe(Coordinate.createCoordinate(99, 1)); Coordinate coordinate = Coordinate.createCoordinate(3, 3); Platform platform = Platform.createPlatform(coordinate); platform.addProbesOnPlatform(Arrays.asList(probe1, probe2)); }
@Test public void testAddProbes() throws CoordinateNotFoundOnPlatformException { SpaceProbe probe1 = createProbe(Coordinate.createCoordinate(1, 2)); SpaceProbe probe2 = createProbe(Coordinate.createCoordinate(3, 1)); Coordinate coordinate = Coordinate.createCoordinate(3, 3); Platform platform = Platform.createPlatform(coordinate); platform.addProbesOnPlatform(Arrays.asList(probe1, probe2)); Assert.assertNotNull(platform.retrieveProbeByCoordinate(probe1.getCoordinate())); Assert.assertNotNull(platform.retrieveProbeByCoordinate(probe2.getCoordinate())); }
@Test public void testExplorePlatformWithProbes() throws CoordinateNotFoundOnPlatformException { SpaceProbe probe1 = createProbe(Coordinate.createCoordinate(1, 2)); SpaceProbe probe2 = createProbe(Coordinate.createCoordinate(3, 1)); Coordinate coordinate = Coordinate.createCoordinate(3, 3); Platform platform = Platform.createPlatform(coordinate); platform.addProbesOnPlatform(Arrays.asList(probe1, probe2)); platform.explorePlatformWithProbes(); Assert.assertEquals( probe1, platform.retrieveProbeByCoordinate(Coordinate.createCoordinate(1, 3))); Assert.assertEquals( probe2, platform.retrieveProbeByCoordinate(Coordinate.createCoordinate(3, 2))); }
@Test public void testCreateNewPlatform() { final long maxLatitude = 5; final long maxLongitude = 5; Coordinate coordinate = Coordinate.createCoordinate(maxLongitude, maxLatitude); Platform platform = Platform.createPlatform(coordinate); Assert.assertEquals(coordinate, platform.getMaxCoordinate()); Assert.assertEquals(Coordinate.minimumCoordinate(), platform.getMinimumCoordinate()); }