Guest User

Untitled

a guest
Nov 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. Bitmap img_Bmp;
  2. TicketsIterator<Bitmap> TicketsList = new TicketsIterator();
  3.  
  4. /*
  5. * Test for the add e get methods, check if the element just insert it's the same of the one just extract.
  6. */
  7. @Test
  8. public void Add_n_Get() throws Exception {
  9. int i = 0, numIMG = 100;
  10. Bitmap[] IMG_Generated;
  11. IMG_Generated = new Bitmap[numIMG];
  12.  
  13. // Generate numIMG of imagine to insert into the Iterator and it save each one of it into an
  14. // Bitmap array usefull for testing of the get method
  15. while (i <= numIMG) {
  16. // Generation of the fake Ticket Bitmap
  17. try {
  18. img_Bmp = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
  19.  
  20. IMG_Generated[i] = img_Bmp;
  21.  
  22. } catch (Exception e) {
  23. // Print the cause of the error just generated
  24. e.getCause().printStackTrace();
  25. }
  26.  
  27. // Addition of the imagine just created
  28. TicketsList.add(img_Bmp);
  29.  
  30. i++;
  31. }
  32.  
  33. // Test if the imagine inserted it is correct
  34. while (i <= numIMG) {
  35. assertTrue(IMG_Generated[i] == TicketsList.get(IMG_Generated[i]));
  36. i++;
  37. }
  38. }
Add Comment
Please, Sign In to add comment