use of org.hamcrest.core.StringEndsWith in project eclipse.platform.ui by eclipse-platform.
the class TestUnitDesktopFileWriter method keepsComments.
@Test
public void keepsComments() {
String comment = "# comment=test";
ArrayList<String> fileContent = new ArrayList<>(fileContentWith("Exec=/usr/bin/eclipse %u", NO_MIME));
fileContent.add(comment);
DesktopFileWriter writer = getWriterFor(fileContent);
assertThat(new String(writer.getResult()), new StringEndsWith(comment));
}
use of org.hamcrest.core.StringEndsWith in project hive by apache.
the class TestMetastoreConf method dumpConfig.
@Test
public void dumpConfig() throws IOException {
createConfFile("metastore-site.xml", true, "METASTORE_HOME", instaMap("test.long", "23"));
conf = MetastoreConf.newMetastoreConf();
String dump = MetastoreConf.dumpConfig(conf);
Assert.assertThat(dump, new StringContains("Used metastore-site file: file:/"));
Assert.assertThat(dump, new StringContains("Key: <test.long> old hive key: <hive.test.long> value: <23>"));
Assert.assertThat(dump, new StringContains("Key: <test.str> old hive key: <hive.test.str> value: <defaultval>"));
Assert.assertThat(dump, new StringEndsWith("Finished MetastoreConf object.\n"));
// Make sure the hidden keys didn't get published
Assert.assertThat(dump, CoreMatchers.not(new StringContains(ConfVars.PWD.getVarname())));
}
use of org.hamcrest.core.StringEndsWith in project oauth2-server by gw2auth.
the class AccountControllerTest method addAccountFederationAlreadyLinkedToOtherAccount.
@WithGw2AuthLogin(issuer = "dummyIssuer", idAtIssuer = "A")
public void addAccountFederationAlreadyLinkedToOtherAccount(MockHttpSession session) throws Exception {
final long otherUserAccountId = this.accountRepository.save(new AccountEntity(null, Instant.now())).id();
this.accountFederationRepository.save(new AccountFederationEntity("dummyIssuer", "B", otherUserAccountId));
final long accountId = AuthenticationHelper.getUser(session).orElseThrow().getAccountId();
final String loginURL = this.mockMvc.perform(get("/api/account/federation/{provider}", "dummyIssuer").session(session)).andExpect(status().is3xxRedirection()).andReturn().getResponse().getRedirectedUrl();
this.gw2AuthLoginExtension.login(loginURL, "dummyIssuer", "B").andExpect(status().is3xxRedirection()).andExpect(header().string("Location", new StringEndsWith("?error")));
// only the initial federation should be present
final List<AccountFederationEntity> result = this.accountFederationRepository.findAllByAccountId(accountId);
assertEquals(1, result.size());
}
Aggregations