本文整理了Java中org.mockito.Mockito.endsWith()
方法的一些代码示例,展示了Mockito.endsWith()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mockito.endsWith()
方法的具体详情如下:
包路径:org.mockito.Mockito
类名称:Mockito
方法名:endsWith
暂无
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
/**
* Verify that information about the fencing target gets passed as
* environment variables to the fencer.
*/
@Test
public void testTargetAsEnvironment() {
if (!Shell.WINDOWS) {
fencer.tryFence(TEST_TARGET, "echo $target_host $target_port");
Mockito.verify(ShellCommandFencer.LOG).info(
Mockito.endsWith("echo $ta...rget_port: dummyhost 1234"));
} else {
fencer.tryFence(TEST_TARGET, "echo %target_host% %target_port%");
Mockito.verify(ShellCommandFencer.LOG).info(
Mockito.endsWith("echo %ta...get_port%: dummyhost 1234"));
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
/**
* Verify that information about the fencing target gets passed as
* environment variables to the fencer.
*/
@Test
public void testTargetAsEnvironment() {
if (!Shell.WINDOWS) {
fencer.tryFence(TEST_TARGET, "echo $target_host $target_port");
Mockito.verify(ShellCommandFencer.LOG).info(
Mockito.endsWith("echo $ta...rget_port: dummyhost 1234"));
} else {
fencer.tryFence(TEST_TARGET, "echo %target_host% %target_port%");
Mockito.verify(ShellCommandFencer.LOG).info(
Mockito.endsWith("echo %ta...get_port%: dummyhost 1234"));
}
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
/**
* Verify that the Configuration gets passed as
* environment variables to the fencer.
*/
@Test
public void testConfAsEnvironment() {
if (!Shell.WINDOWS) {
fencer.tryFence(TEST_TARGET, "echo $in_fencing_tests");
Mockito.verify(ShellCommandFencer.LOG).info(
Mockito.endsWith("echo $in...ing_tests: yessir"));
} else {
fencer.tryFence(TEST_TARGET, "echo %in_fencing_tests%");
Mockito.verify(ShellCommandFencer.LOG).info(
Mockito.endsWith("echo %in...ng_tests%: yessir"));
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
/**
* Verify that the Configuration gets passed as
* environment variables to the fencer.
*/
@Test
public void testConfAsEnvironment() {
if (!Shell.WINDOWS) {
fencer.tryFence(TEST_TARGET, "echo $in_fencing_tests");
Mockito.verify(ShellCommandFencer.LOG).info(
Mockito.endsWith("echo $in...ing_tests: yessir"));
} else {
fencer.tryFence(TEST_TARGET, "echo %in_fencing_tests%");
Mockito.verify(ShellCommandFencer.LOG).info(
Mockito.endsWith("echo %in...ng_tests%: yessir"));
}
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
/**
* Test that lines on stdout get passed as INFO
* level messages
*/
@Test
public void testStdoutLogging() {
assertTrue(fencer.tryFence(TEST_TARGET, "echo hello"));
Mockito.verify(ShellCommandFencer.LOG).info(
Mockito.endsWith("echo hello: hello"));
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
/**
* Test that lines on stderr get passed as
* WARN level log messages
*/
@Test
public void testStderrLogging() {
assertTrue(fencer.tryFence(TEST_TARGET, "echo hello>&2"));
Mockito.verify(ShellCommandFencer.LOG).warn(
Mockito.endsWith("echo hello>&2: hello"));
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
/**
* Test that lines on stdout get passed as INFO
* level messages
*/
@Test
public void testStdoutLogging() {
assertTrue(fencer.tryFence(TEST_TARGET, "echo hello"));
Mockito.verify(ShellCommandFencer.LOG).info(
Mockito.endsWith("echo hello: hello"));
}
代码示例来源:origin: sixhours-team/memcached-spring-boot
@Test
public void whenPutAndNamespaceMissingThenSetNamespace() {
when(memcachedClient.get(namespaceKey)).thenReturn(null);
memcachedCache.put(CACHED_OBJECT_KEY, cachedValue);
verify(memcachedClient).get(namespaceKey);
verify(memcachedClient).set(eq(namespaceKey), eq(CACHE_EXPIRATION), anyString());
verify(memcachedClient).set(endsWith(CACHED_OBJECT_KEY), eq(CACHE_EXPIRATION), eq(cachedValue));
verify(memcachedClient).touch(namespaceKey, CACHE_EXPIRATION);
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
/**
* Test that lines on stderr get passed as
* WARN level log messages
*/
@Test
public void testStderrLogging() {
assertTrue(fencer.tryFence(TEST_TARGET, "echo hello>&2"));
Mockito.verify(ShellCommandFencer.LOG).warn(
Mockito.endsWith("echo hello>&2: hello"));
}
代码示例来源:origin: pentaho/pentaho-platform
when( session.getItem( endsWith( "/other" ) ) ).thenReturn( nodeOtherFolder );
when( session.getItem( endsWith( "/test" ) ) ).thenReturn( nodeUserFolder );
代码示例来源:origin: blurpy/kouchat-android
/**
* Tests sendClient().
*
* Expects: 13132531!CLIENT#Christian:(KouChat v0.9.9-dev null)[134]{Linux}<2222>/4444\
*/
@Test
public void testSendClientMessage() {
final String startsWith = "(" + me.getClient() + ")[";
final String middle = ".+\\)\\[\\d+\\]\\{.+"; // like:)[134[{
final String endsWidth = "]{" + me.getOperatingSystem() + "}<2222>/4444\\";
messages.sendClient();
verify(service).sendMessageToAllUsers(startsWith(createMessage("CLIENT") + startsWith));
verify(service).sendMessageToAllUsers(matches(middle));
verify(service).sendMessageToAllUsers(endsWith(endsWidth));
}
内容来源于网络,如有侵权,请联系作者删除!