@Transactional(TransactionMode.DISABLED) @Test @UsingDataSet({"profile.yml", "social_connections.yml"}) public void shouldFindProfileWithSocialConnections() throws Exception { Profile profile = profileRepository.findWithSocialConnections("test_user"); Assert.assertThat(profile.getSocialConnections(), hasSize(2)); for (SocialConnection socialConnection : profile.getSocialConnections()) { Assert.assertEquals(SocialProvider.TWITTER, socialConnection.getProvider()); } }
@Test @ShouldMatchDataSet( value = {"profile.yml", "social_connection.yml"}, excludeColumns = {"id"}) public void save_NewProfileWithSocialConnection_ShouldPersist() throws Exception { Profile profile = createProfile(); profile.addSocialConnection(createSocialConnection()); Profile saved = profileRepository.save(profile); Profile persistedProfile = profileRepository.get(saved.getId()); for (SocialConnection socialConnection : persistedProfile.getSocialConnections()) { Assert.assertNotNull(socialConnection.getId()); } }