当前位置: 首页>>代码示例>>Java>>正文


Java Assert.assertFalse方法代码示例

本文整理汇总了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();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:17,代码来源:HessianProtocolTest.java

示例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);
    }
  }
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:19,代码来源:TriggerPropertyTest.java

示例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);
}
 
开发者ID:akharchuk,项目名称:rate-limiting,代码行数:22,代码来源:EMARateCalculatorTest.java

示例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);
}
 
开发者ID:Welloculus,项目名称:MobileAppForPatient,代码行数:17,代码来源:ChangePasswordActivityTest.java

示例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));
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:29,代码来源:TestPeriodPredicates.java

示例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));
}
 
开发者ID:AppGratis,项目名称:unlock-android,代码行数:19,代码来源:ConditionTests.java

示例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);
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:12,代码来源:TriggerTest.java

示例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;
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:15,代码来源:ClassSanityTester.java

示例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()));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:Many2OneUniSaveTest.java

示例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);
}
 
开发者ID:eduyayo,项目名称:gamesboard,代码行数:13,代码来源:DotsControllerByMessagesTest.java

示例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);
}
 
开发者ID:yunhaibin,项目名称:dubbox-hystrix,代码行数:36,代码来源:RegistryDirectoryTest.java

示例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);
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:13,代码来源:TriggerTest.java

示例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));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:LongExtraTypeTest.java

示例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));

}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:41,代码来源:TestHttpServer.java

示例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));
}
 
开发者ID:actiontech,项目名称:dble,代码行数:12,代码来源:DruidMysqlCreateTableTest.java


注:本文中的junit.framework.Assert.assertFalse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。