本文整理了Java中junit.framework.TestCase.assertFalse()
方法的一些代码示例,展示了TestCase.assertFalse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TestCase.assertFalse()
方法的具体详情如下:
包路径:junit.framework.TestCase
类名称:TestCase
方法名:assertFalse
[英]Asserts that a condition is false. If it isn't it throws an AssertionFailedError with the given message.
[中]断言某个条件是错误的。如果不是,则会抛出带有给定消息的AssertionFailedError。
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testFieldDefault() throws Exception {
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
formData.add("!postProcessed", "off");
formData.add("postProcessed", "on");
this.binder.bind(exchange(formData)).block(Duration.ofMillis(5000));
assertTrue(this.testBean.isPostProcessed());
formData.remove("postProcessed");
this.binder.bind(exchange(formData)).block(Duration.ofMillis(5000));
assertFalse(this.testBean.isPostProcessed());
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testFieldPrefixCausesFieldReset() throws Exception {
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
formData.add("_postProcessed", "visible");
formData.add("postProcessed", "on");
this.binder.bind(exchange(formData)).block(Duration.ofMillis(5000));
assertTrue(this.testBean.isPostProcessed());
formData.remove("postProcessed");
this.binder.bind(exchange(formData)).block(Duration.ofMillis(5000));
assertFalse(this.testBean.isPostProcessed());
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testFieldPrefixCausesFieldResetWithIgnoreUnknownFields() throws Exception {
this.binder.setIgnoreUnknownFields(false);
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
formData.add("_postProcessed", "visible");
formData.add("postProcessed", "on");
this.binder.bind(exchange(formData)).block(Duration.ofMillis(5000));
assertTrue(this.testBean.isPostProcessed());
formData.remove("postProcessed");
this.binder.bind(exchange(formData)).block(Duration.ofMillis(5000));
assertFalse(this.testBean.isPostProcessed());
}
代码示例来源:origin: square/okio
@Test public void sourceIsOpen() throws Exception {
BufferedSource source = Okio.buffer((Source) new Buffer());
assertTrue(source.isOpen());
source.close();
assertFalse(source.isOpen());
}
代码示例来源:origin: square/okio
@Test public void sinkIsOpen() throws Exception {
BufferedSink sink = Okio.buffer((Sink) new Buffer());
assertTrue(sink.isOpen());
sink.close();
assertFalse(sink.isOpen());
}
代码示例来源:origin: airbnb/epoxy
@Test
public void testRemoveObjectNotAdded() {
boolean removed = modelList.remove(new TestModel());
assertFalse(removed);
verifyNoMoreInteractions(observer);
}
代码示例来源:origin: iSoron/uhabits
@Test
public void canArchive() throws Exception
{
when(adapter.getSelected()).thenReturn(asList(habit1, habit2));
assertFalse(behavior.canArchive());
when(adapter.getSelected()).thenReturn(asList(habit2, habit3));
assertTrue(behavior.canArchive());
}
代码示例来源:origin: iSoron/uhabits
@Test
public void canEdit() throws Exception
{
when(adapter.getSelected()).thenReturn(singletonList(habit1));
assertTrue(behavior.canEdit());
when(adapter.getSelected()).thenReturn(asList(habit1, habit2));
assertFalse(behavior.canEdit());
}
代码示例来源:origin: iSoron/uhabits
@Test
public void canUnarchive() throws Exception
{
when(adapter.getSelected()).thenReturn(asList(habit1, habit2));
assertFalse(behavior.canUnarchive());
when(adapter.getSelected()).thenReturn(singletonList(habit1));
assertTrue(behavior.canUnarchive());
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testFieldDefaultPreemptsFieldMarker() throws Exception {
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
formData.add("!postProcessed", "on");
formData.add("_postProcessed", "visible");
formData.add("postProcessed", "on");
this.binder.bind(exchange(formData)).block(Duration.ofMillis(5000));
assertTrue(this.testBean.isPostProcessed());
formData.remove("postProcessed");
this.binder.bind(exchange(formData)).block(Duration.ofMillis(5000));
assertTrue(this.testBean.isPostProcessed());
formData.remove("!postProcessed");
this.binder.bind(exchange(formData)).block(Duration.ofMillis(5000));
assertFalse(this.testBean.isPostProcessed());
}
代码示例来源:origin: iSoron/uhabits
@Test
public void onArchiveHabits() throws Exception
{
assertFalse(habit2.isArchived());
when(adapter.getSelected()).thenReturn(singletonList(habit2));
behavior.onArchiveHabits();
assertTrue(habit2.isArchived());
}
代码示例来源:origin: iSoron/uhabits
@Test
public void onUnarchiveHabits() throws Exception
{
assertTrue(habit1.isArchived());
when(adapter.getSelected()).thenReturn(singletonList(habit1));
behavior.onUnarchiveHabits();
assertFalse(habit1.isArchived());
}
代码示例来源:origin: gocd/gocd
@Test
public void shouldBeAbleToAnswerIfPluginSupportsPasswordBasedAuthentication() throws Exception {
assertTrue(store.doesPluginSupportPasswordBasedAuthentication("password.plugin-2"));
assertFalse(store.doesPluginSupportPasswordBasedAuthentication("web.plugin-1"));
}
代码示例来源:origin: gocd/gocd
@Test
public void shouldNotErrorWhenTargetVersionInResponse() {
String json = "{\n" +
" \"target_version\" : 1,\n" +
" \"pipelines\" : [],\n" +
" \"errors\" : []\n" +
"}";
makeMigratorReturnSameJSON();
CRParseResult result = handler.responseMessageForParseDirectory(json);
assertFalse(result.hasErrors());
}
代码示例来源:origin: web3j/web3j
@Test
public void testNetVersion() throws Exception {
NetVersion netVersion = web3j.netVersion().send();
assertFalse(netVersion.getNetVersion().isEmpty());
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthProtocolVersion() throws Exception {
EthProtocolVersion ethProtocolVersion = web3j.ethProtocolVersion().send();
assertFalse(ethProtocolVersion.getProtocolVersion().isEmpty());
}
代码示例来源:origin: eclipse-vertx/vert.x
@Test
public void testStreamHandle() {
FakeStream stream = new FakeStream();
JsonParser parser = JsonParser.newParser(stream);
List<JsonEvent> events = new ArrayList<>();
parser.handler(events::add);
stream.handle("{}");
assertFalse(stream.isPaused());
assertEquals(2, events.size());
}
代码示例来源:origin: iSoron/uhabits
@Test
public void shouldShow() throws Exception
{
when(prefs.getLastHintTimestamp()).thenReturn(today);
assertFalse(hintList.shouldShow());
when(prefs.getLastHintTimestamp()).thenReturn(yesterday);
assertTrue(hintList.shouldShow());
}
}
代码示例来源:origin: iSoron/uhabits
@Test
public void testOnToggleShowArchived()
{
behavior.onToggleShowArchived();
verify(adapter).setFilter(matcherCaptor.capture());
assertTrue(matcherCaptor.getValue().isArchivedAllowed());
clearInvocations(adapter);
behavior.onToggleShowArchived();
verify(adapter).setFilter(matcherCaptor.capture());
assertFalse(matcherCaptor.getValue().isArchivedAllowed());
}
代码示例来源:origin: iSoron/uhabits
@Test
public void testOnToggleShowCompleted()
{
behavior.onToggleShowCompleted();
verify(adapter).setFilter(matcherCaptor.capture());
assertTrue(matcherCaptor.getValue().isCompletedAllowed());
clearInvocations(adapter);
behavior.onToggleShowCompleted();
verify(adapter).setFilter(matcherCaptor.capture());
assertFalse(matcherCaptor.getValue().isCompletedAllowed());
}
内容来源于网络,如有侵权,请联系作者删除!