@Before
  public void setUp() throws Exception {
    // First version
    version1 = new VersionEntity();
    version1.setName("0.0.1");
    versionRepository.save(version1);
    // Second version
    version2 = new VersionEntity();
    version2.setName("0.9.3-SNAPSHOT");
    versionRepository.save(version2);

    // Build Application
    application = new ApplicationEntity();
    application.setName("Application");
    application.getVersionEntities().add(version1);
    application.getVersionEntities().add(version2);

    savedApplication = applicationRepository.save(application);
    em.flush();
    em.clear();
  }
 @Test
 public void testAppHasMultipleVersions() throws Exception {
   ApplicationEntity application = applicationRepository.findOne(savedApplication.getId());
   List<VersionEntity> appVersions = application.getVersionEntities();
   assertThat(appVersions.size()).isEqualTo(2);
 }
 @Test
 public void testManyToMany() throws IOException {
   List<ApplicationEntity> applications = applicationRepository.findAll();
   assertThat(applications).isNotNull();
   assertThat(applications).isNotEmpty();
 }
 @Test
 public void testVersionsAreSaved() throws Exception {
   ApplicationEntity one = applicationRepository.findOne(savedApplication.getId());
   assertThat(one.getVersionEntities()).isNotEmpty();
 }