本文整理汇总了Java中junit.framework.Assert.assertFalse方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.assertFalse方法的具体用法?Java Assert.assertFalse怎么用?Java Assert.assertFalse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类junit.framework.Assert
的用法示例。
在下文中一共展示了Assert.assertFalse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testHessianProtocol
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void testHessianProtocol() {
HessianServiceImpl server = new HessianServiceImpl();
Assert.assertFalse(server.isCalled());
ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension();
Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension();
URL url = URL.valueOf("hessian://127.0.0.1:5342/" + HessianService.class.getName() + "?version=1.0.0");
Exporter<HessianService> exporter = protocol.export(proxyFactory.getInvoker(server, HessianService.class, url));
Invoker<HessianService> invoker = protocol.refer(HessianService.class, url);
HessianService client = proxyFactory.getProxy(invoker);
String result = client.sayHello("haha");
Assert.assertTrue(server.isCalled());
Assert.assertEquals("Hello, haha", result);
invoker.destroy();
exporter.unexport();
}
示例2: stepDistanceRemainingProperty_onlyPassesValidationWhenEqual
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void stepDistanceRemainingProperty_onlyPassesValidationWhenEqual() {
double stepDistance = routeProgress.currentLegProgress().currentStepProgress().distanceRemaining();
for (int i = 10; i > 0; i--) {
Milestone milestone = new StepMilestone.Builder()
.setTrigger(
Trigger.eq(TriggerProperty.STEP_DISTANCE_REMAINING_METERS, (stepDistance / i))
).build();
boolean result = milestone.isOccurring(routeProgress, routeProgress);
if ((stepDistance / i) == stepDistance) {
Assert.assertTrue(result);
} else {
Assert.assertFalse(result);
}
}
}
示例3: testPathRate_Exceed
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void testPathRate_Exceed() throws IOException {
double requestsPerTimeUnit = 100;
Double timeConstant = 0.3;
// settings = ConfigTest.loadTestSettings();
final int hash = 487587236;
EMARateCalculator calculator = new EMARateCalculator(rateRecordMap);
RateLimit limit = new RateLimit(timeUnit, requestsPerTimeUnit, rateExceededResponse, timeConstant);
boolean exceeded = false;
for (int i = 0; i < 200; i++) {
exceeded = exceeded || calculator.exceedsRate(hash, limit);
if (i < 1)
Assert.assertFalse("We are not supposed to exceed rate", exceeded);
}
Assert.assertTrue("We were supposed to exceed rate", exceeded);
}
示例4: testChangePassword_blankCurrentPassword
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void testChangePassword_blankCurrentPassword() {
EditText mEtCurrPassword = (EditText) activity.findViewById(R.id.editTextChangePassCurrPass);
EditText mEtNewPassword = (EditText) activity.findViewById(R.id.editTextChangePassNewPass);
EditText mEtConfirmNewPassword = (EditText) activity.findViewById(R.id.editTextConfirmPassNewPass);
Button mBtnChange = (Button) activity.findViewById(R.id.change_pass_button);
mEtCurrPassword.setText("");
mEtNewPassword.setText("QWERTY");
mEtConfirmNewPassword.setText("QWERTY");
TextView label = (TextView) activity.findViewById(R.id.textViewChangePassCurrPassMessage);
Assert.assertFalse("current password lable is been set before change password",label.getText().length()>1);
mBtnChange.performClick();
Assert.assertTrue("current password lable is not been set",label.getText().length()>1);
}
示例5: testFirstPeriodCannotContainsSecondPeriodIfTheyAreEquals
import junit.framework.Assert; //导入方法依赖的package包/类
/**
* (TIMESTAMP '1999-12-01 01:02:03', TIMESTAMP '1999-12-02 01:02:03')
* CONTAINS
* TIMESTAMP '1999-12-01 01:02:03'
* is false
*/
public void testFirstPeriodCannotContainsSecondPeriodIfTheyAreEquals() {
Object[] a = {
scanner.newTimestamp("1999-12-01 01:02:01"),
scanner.newTimestamp("1999-12-01 01:02:03")
};
Object[] b = {
scanner.newTimestamp("1999-12-01 01:02:03"),
null
};
Type[] ta = {
new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0),
new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0)
};
Type[] tb = {
new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0),
new DateTimeType(Types.SQL_TIMESTAMP, Types.SQL_TIMESTAMP, 0)
};
Assert.assertFalse(DateTimeType.contains(session, a, ta, b, tb,
true));
}
示例6: testNewUsersCondition
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void testNewUsersCondition() throws Exception {
final MockDateProvider dateProvider = new MockDateProvider(TEST_DATE_FORMAT.parse("2016-02-02 18:00:00"), TEST_DATE_FORMAT.parse("2010-01-01 18:00:00"));
final MockDateProvider dateProviderAfterStart = new MockDateProvider(TEST_DATE_FORMAT.parse("2016-02-02 18:00:00"), TEST_DATE_FORMAT.parse("2016-02-02 18:00:00"));
final BaseCondition mockCondition = new BaseCondition();
mockCondition.startDate = TEST_DATE_FORMAT.parse("2016-02-02 18:00:00");
mockCondition.endDate = null;
mockCondition.newUsersOnly = false;
Assert.assertTrue(mockCondition.isSatisfied(dateProvider));
Assert.assertTrue(mockCondition.isSatisfied(dateProviderAfterStart));
mockCondition.newUsersOnly = true;
Assert.assertFalse(mockCondition.isSatisfied(dateProvider));
Assert.assertTrue(mockCondition.isSatisfied(dateProviderAfterStart));
}
示例7: greaterThanEqual_validatesToFalse
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void greaterThanEqual_validatesToFalse() {
Milestone milestone = new StepMilestone.Builder()
.setTrigger(
Trigger.gte(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 10000d)
)
.build();
boolean result = milestone.isOccurring(routeProgress, routeProgress);
Assert.assertFalse(result);
}
示例8: getFactoriesToTest
import junit.framework.Assert; //导入方法依赖的package包/类
private ImmutableList<Invokable<?, ?>> getFactoriesToTest() {
ImmutableList.Builder<Invokable<?, ?>> builder = ImmutableList.builder();
for (Invokable<?, ?> factory : factories) {
if (returnTypeToTest.isAssignableFrom(factory.getReturnType().getRawType())) {
builder.add(factory);
}
}
ImmutableList<Invokable<?, ?>> factoriesToTest = builder.build();
Assert.assertFalse("No " + factoryMethodsDescription + " that return "
+ returnTypeToTest.getName() + " or subtype are found in "
+ declaringClass + ".",
factoriesToTest.isEmpty());
return factoriesToTest;
}
示例9: testSaveFast
import junit.framework.Assert; //导入方法依赖的package包/类
public void testSaveFast() {
init();
c1.getTeachers().add(t1);
c1.getTeachers().add(t2);
c1.saveFast();
t1.saveFast();
t2.saveFast();
isDataExists(getTableName(c1), c1.get_id());
isDataExists(getTableName(t1), t1.getId());
isDataExists(getTableName(t2), t2.getId());
Assert.assertFalse(isFKInsertCorrect(getTableName(c1), getTableName(t1), c1.get_id(),
t1.getId()));
Assert.assertFalse(isFKInsertCorrect(getTableName(c1), getTableName(t2), c1.get_id(),
t2.getId()));
}
示例10: testEndGame
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void testEndGame() throws NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException {
the1000moves();
Assert.assertTrue(gameEndedPigdroid);
Assert.assertTrue(gameEndedEduyayo);
Assert.assertFalse(pigdroidWinner);
Assert.assertFalse(eduyayoWinner);
}
示例11: testNotifyoverrideUrls_Nouse
import junit.framework.Assert; //导入方法依赖的package包/类
/**
* 测试override规则是否优先
* 场景:推送的规则与provider的参数是一样的
* 期望:不需要重新引用
*/
@Test
public void testNotifyoverrideUrls_Nouse(){
RegistryDirectory registryDirectory = getRegistryDirectory();
invocation = new RpcInvocation();
List<URL> durls = new ArrayList<URL>();
durls.add(SERVICEURL.addParameter("timeout", "1"));//一个一样,一个不一样
durls.add(SERVICEURL2.addParameter("timeout", "1").addParameter("connections", "5"));
registryDirectory.notify(durls);
List<Invoker<?>> invokers = registryDirectory.list(invocation);
Assert.assertEquals(2, invokers.size());
Invoker<?> a1Invoker = invokers.get(0);
Invoker<?> b1Invoker = invokers.get(1);
durls = new ArrayList<URL>();
durls.add(URL.valueOf("override://0.0.0.0?timeout=1&connections=5"));
registryDirectory.notify(durls);
Assert.assertEquals(true, registryDirectory.isAvailable());
invokers = registryDirectory.list(invocation);
Assert.assertEquals(2, invokers.size());
Invoker<?> a2Invoker = invokers.get(0);
Invoker<?> b2Invoker = invokers.get(1);
//参数不一样,必须重新引用
Assert.assertFalse("object not same",a1Invoker == a2Invoker);
//参数一样,不能重新引用
Assert.assertTrue("object same",b1Invoker == b2Invoker);
}
示例12: triggerNone_onoConditionsTrue
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void triggerNone_onoConditionsTrue() {
Milestone milestone = new StepMilestone.Builder()
.setTrigger(Trigger.none(
Trigger.gt(TriggerProperty.STEP_DURATION_REMAINING_SECONDS, 100d),
Trigger.gt(TriggerProperty.STEP_DISTANCE_TOTAL_METERS, 100d)
))
.build();
boolean result = milestone.isOccurring(routeProgress, routeProgress);
Assert.assertFalse(result);
}
示例13: testEquals
import junit.framework.Assert; //导入方法依赖的package包/类
public void testEquals() {
LongExtraType otherLongExtra = new LongExtraType();
BottomType bottom = new BottomType();
Assert.assertEquals(longExtraType, otherLongExtra);
Assert.assertFalse(longExtraType.equals(bottom));
}
示例14: testHasAdministratorAccess
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void testHasAdministratorAccess() throws Exception {
Configuration conf = new Configuration();
conf.setBoolean(CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, false);
ServletContext context = Mockito.mock(ServletContext.class);
Mockito.when(context.getAttribute(HttpServer.CONF_CONTEXT_ATTRIBUTE)).thenReturn(conf);
Mockito.when(context.getAttribute(HttpServer.ADMINS_ACL)).thenReturn(null);
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
Mockito.when(request.getRemoteUser()).thenReturn(null);
HttpServletResponse response = Mockito.mock(HttpServletResponse.class);
//authorization OFF
Assert.assertTrue(HttpServer.hasAdministratorAccess(context, request, response));
//authorization ON & user NULL
response = Mockito.mock(HttpServletResponse.class);
conf.setBoolean(CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, true);
Assert.assertFalse(HttpServer.hasAdministratorAccess(context, request, response));
Mockito.verify(response).sendError(Mockito.eq(HttpServletResponse.SC_UNAUTHORIZED), Mockito.anyString());
//authorization ON & user NOT NULL & ACLs NULL
response = Mockito.mock(HttpServletResponse.class);
Mockito.when(request.getRemoteUser()).thenReturn("foo");
Assert.assertTrue(HttpServer.hasAdministratorAccess(context, request, response));
//authorization ON & user NOT NULL & ACLs NOT NULL & user not in ACLs
response = Mockito.mock(HttpServletResponse.class);
AccessControlList acls = Mockito.mock(AccessControlList.class);
Mockito.when(acls.isUserAllowed(Mockito.<UserGroupInformation>any())).thenReturn(false);
Mockito.when(context.getAttribute(HttpServer.ADMINS_ACL)).thenReturn(acls);
Assert.assertFalse(HttpServer.hasAdministratorAccess(context, request, response));
Mockito.verify(response).sendError(Mockito.eq(HttpServletResponse.SC_UNAUTHORIZED), Mockito.anyString());
//authorization ON & user NOT NULL & ACLs NOT NULL & user in in ACLs
response = Mockito.mock(HttpServletResponse.class);
Mockito.when(acls.isUserAllowed(Mockito.<UserGroupInformation>any())).thenReturn(true);
Mockito.when(context.getAttribute(HttpServer.ADMINS_ACL)).thenReturn(acls);
Assert.assertTrue(HttpServer.hasAdministratorAccess(context, request, response));
}
示例15: testCreate
import junit.framework.Assert; //导入方法依赖的package包/类
@Test
public void testCreate() throws SQLException {
SchemaConfig schema = schemaMap.get("mysqldb");
RouteResultset rrs = routeStrategy.route(schema, -1, originSql1, sc, cachePool);
Assert.assertEquals(2, rrs.getNodes().length);
String sql = rrs.getNodes()[0].getStatement();
//Assert.assertTrue(parseSql(sql));
Assert.assertFalse(parseSql(sql));
}