kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 941704f40983f6c62f99ad6fef7f70bfebd88958bde73c052a208252ef008d13 |
|---|---|
| Author | Alexandre Dutra <alexandre.dutra@datastax.com> · 2016-07-12 22:12 +02:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2016-07-22 09:47 -07:00 |
| Parents | bc1383606a33 |
1 file changed
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperPolymorphismTest.java +8 −15
| @@ -20,7 +20,6 @@ | ||
| 20 | 20 | import com.google.common.base.Objects; |
| 21 | 21 | import com.google.common.collect.Sets; |
| 22 | 22 | import org.testng.annotations.AfterMethod; |
| 23 | -import org.testng.annotations.BeforeClass; | |
| 24 | 23 | import org.testng.annotations.Test; |
| 25 | 24 | |
| 26 | 25 | import java.util.Set; |
| @@ -41,11 +40,6 @@ | ||
| 41 | 40 | Square square = new Square(new Point2D(20, 30), new Point2D(50, 60)); |
| 42 | 41 | Sphere sphere = new Sphere(new Point3D(11, 22, 33), 34.56); |
| 43 | 42 | |
| 44 | - Mapper<Circle> circleMapper; | |
| 45 | - Mapper<Rectangle> rectangleMapper; | |
| 46 | - Mapper<Square> squareMapper; | |
| 47 | - Mapper<Sphere> sphereMapper; | |
| 48 | - | |
| 49 | 43 | @Override |
| 50 | 44 | public void onTestContextInitialized() { |
| 51 | 45 | execute( |
| @@ -57,15 +51,6 @@ | ||
| 57 | 51 | "CREATE TABLE spheres (sphere_id uuid PRIMARY KEY, center3d frozen<point3d>, radius double, tags set<text>)"); |
| 58 | 52 | } |
| 59 | 53 | |
| 60 | - @BeforeClass(groups = "short") | |
| 61 | - public void createMappers() throws Exception { | |
| 62 | - MappingManager mappingManager = new MappingManager(session()); | |
| 63 | - circleMapper = mappingManager.mapper(Circle.class); | |
| 64 | - rectangleMapper = mappingManager.mapper(Rectangle.class); | |
| 65 | - squareMapper = mappingManager.mapper(Square.class); | |
| 66 | - sphereMapper = mappingManager.mapper(Sphere.class); | |
| 67 | - } | |
| 68 | - | |
| 69 | 54 | @AfterMethod(groups = "short") |
| 70 | 55 | public void clean() { |
| 71 | 56 | execute("TRUNCATE circles", "TRUNCATE rectangles", "TRUNCATE squares", "TRUNCATE spheres"); |
| @@ -463,24 +448,32 @@ | ||
| 463 | 448 | |
| 464 | 449 | @Test(groups = "short") |
| 465 | 450 | public void should_save_and_retrieve_circle() throws Exception { |
| 451 | + MappingManager mappingManager = new MappingManager(session()); | |
| 452 | + Mapper<Circle> circleMapper = mappingManager.mapper(Circle.class); | |
| 466 | 453 | circleMapper.save(circle); |
| 467 | 454 | assertThat(circleMapper.get(circle.getId())).isEqualTo(circle); |
| 468 | 455 | } |
| 469 | 456 | |
| 470 | 457 | @Test(groups = "short") |
| 471 | 458 | public void should_save_and_retrieve_rectangle() throws Exception { |
| 459 | + MappingManager mappingManager = new MappingManager(session()); | |
| 460 | + Mapper<Rectangle> rectangleMapper = mappingManager.mapper(Rectangle.class); | |
| 472 | 461 | rectangleMapper.save(rectangle); |
| 473 | 462 | assertThat(rectangleMapper.get(rectangle.getId())).isEqualTo(rectangle); |
| 474 | 463 | } |
| 475 | 464 | |
| 476 | 465 | @Test(groups = "short") |
| 477 | 466 | public void should_save_and_retrieve_square() throws Exception { |
| 467 | + MappingManager mappingManager = new MappingManager(session()); | |
| 468 | + Mapper<Square> squareMapper = mappingManager.mapper(Square.class); | |
| 478 | 469 | squareMapper.save(square); |
| 479 | 470 | assertThat(squareMapper.get(square.getId())).isEqualTo(square); |
| 480 | 471 | } |
| 481 | 472 | |
| 482 | 473 | @Test(groups = "short") |
| 483 | 474 | public void should_save_and_retrieve_sphere() throws Exception { |
| 475 | + MappingManager mappingManager = new MappingManager(session()); | |
| 476 | + Mapper<Sphere> sphereMapper = mappingManager.mapper(Sphere.class); | |
| 484 | 477 | sphereMapper.save(sphere); |
| 485 | 478 | assertThat(sphereMapper.get(sphere.getId())).isEqualTo(sphere); |
| 486 | 479 | } |