Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andra Bisca
committed
Oct 23, 2018
1 parent
21fa8c2
commit bd4f9fb
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package ch.epfl.sweng.runpharaa; | ||
|
||
import android.graphics.Bitmap; | ||
import android.graphics.BitmapFactory; | ||
|
||
import com.google.android.gms.maps.model.LatLng; | ||
|
||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.ExpectedException; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import ch.epfl.sweng.runpharaa.tracks.Track; | ||
import ch.epfl.sweng.runpharaa.tracks.TrackProperties; | ||
import ch.epfl.sweng.runpharaa.tracks.TrackType; | ||
|
||
public class TrackTest { | ||
|
||
@Rule | ||
public final ExpectedException exception = ExpectedException.none(); | ||
private Bitmap b; | ||
private Set<TrackType> types; | ||
private TrackProperties p; | ||
private LatLng coord0; | ||
private LatLng coord1; | ||
private LatLng[] path; | ||
private Track legalTestTrack; | ||
|
||
@Before | ||
public void init() { | ||
b = Bitmap.createBitmap(200, 100, Bitmap.Config.ARGB_8888); | ||
types = new HashSet<>(); | ||
types.add(TrackType.FOREST); | ||
p = new TrackProperties(100, 10, 1, 1, types); | ||
|
||
coord0 = new LatLng(46.518577, 6.563165); | ||
coord1 = new LatLng(46.522735, 6.579772); | ||
|
||
path = new LatLng[]{coord0, coord1}; | ||
|
||
legalTestTrack = new Track("7864", "Bob", b, "test", path , p); | ||
} | ||
|
||
@Test | ||
public void PathWithLessThan2PointsThrowsException() { | ||
|
||
LatLng[] path = {coord0}; | ||
|
||
exception.expect(IllegalArgumentException.class); | ||
new Track("8498", "Bob", b, "test", path, p); | ||
|
||
} | ||
|
||
@Test | ||
public void startingPositionIsCorrect(){ | ||
assert legalTestTrack.getStartingPoint().equals(coord0); | ||
} | ||
} |