Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. @Test
  2. public void isUserFinishedTrip() throws Exception {
  3. Location location = new Location("Target");
  4. location.setLatitude(55.689681);
  5. location.setLongitude(22.322333);
  6. CircleGeofence.targetLocation = location;
  7. assertEquals(true, CircleGeofence.isUserFinishedTrip(location));
  8. }
  9.  
  10.  
  11.  
  12.  
  13.  
  14. Klasių „LakeLayerGeofence.java“ metodai:
  15. @Test
  16. public void isUserInLake() throws Exception {
  17. ArrayList<LatLong> latLongs = new ArrayList<>();
  18. latLongs.add(new LatLong(54.907584, 23.838378));
  19. latLongs.add(new LatLong(54.893736, 23.822805));
  20. latLongs.add(new LatLong(54.873623, 23.815401));
  21. latLongs.add(new LatLong(54.841551, 23.928823));
  22. latLongs.add(new LatLong(54.882190, 23.989455));
  23. latLongs.add(new LatLong(54.941970, 24.011399));
  24.  
  25. assertEquals(true, geofence.isUserInLake(latLongs, 54.841551, 23.928823));
  26.  
  27. }
  28.  
  29. @Test
  30. public void isUserCollidesWithIsland() throws Exception {
  31. ArrayList<LatLong> latLongs = new ArrayList<>();
  32. latLongs.add(new LatLong(54.907584, 23.838378));
  33. latLongs.add(new LatLong(54.893736, 23.822805));
  34. latLongs.add(new LatLong(54.873623, 23.815401));
  35. latLongs.add(new LatLong(54.841551, 23.928823));
  36. latLongs.add(new LatLong(54.882190, 23.989455));
  37. latLongs.add(new LatLong(54.941970, 24.011399));
  38.  
  39. assertEquals(false, geofence.isUserCollidesWithIsland(latLongs, 54.841551, 23.928823));
  40. }
  41.  
  42. Šios klasės testavimo metodas parodo ar dabartinis laikas nepatenka į nurodytą intervalą
  43. @Test
  44. public void canFish() throws Exception {
  45. Calendar calendar = Calendar.getInstance();
  46. FishWarning fishWarning = new FishWarning();
  47. assertEquals(false, fishWarning.canFish(calendar, 5, 14, 12, 15));
  48. }
  49.  
  50.  
  51. Šios klasės testavimo metodas patikrina grąžintą normalizacijos laipsnį
  52. @Test
  53. public void normalizeDegree() throws Exception {
  54. float expDegree = 550;
  55.  
  56. Compass compass = new Compass();
  57. float result = compass.normalizeDegree(190);
  58. assertEquals(0, expDegree, result);
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement