@Test @Transactional public void testReadByPrimaryKeyValidUser() throws Exception { ExternalAccount account = service.getExternalAccount(SocialNetworkID.LINKEDIN, "1234"); assertThat(account.getSilverpeasUserId(), is("11")); assertThat(account.getNetworkId(), is(SocialNetworkID.LINKEDIN)); }
@Test public void testReadByPrimaryKeyUnexistingUser() throws Exception { Transaction.performInOne( () -> { ExternalAccount account = service.getExternalAccount(SocialNetworkID.LINKEDIN, "1233"); assertThat(account, nullValue()); return null; }); }
@Test @Transactional public void testCreateExternalAccount() throws Exception { Transaction.performInOne( () -> { service.createExternalAccount(SocialNetworkID.FACEBOOK, "13", "1345"); return null; }); ExternalAccount account = service.getExternalAccount(SocialNetworkID.FACEBOOK, "1345"); assertThat(account, is(notNullValue())); assertThat(account.getSilverpeasUserId(), is("13")); }