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


Java Assert.assertEquals方法代码示例

本文整理汇总了Java中org.junit.Assert.assertEquals方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.assertEquals方法的具体用法?Java Assert.assertEquals怎么用?Java Assert.assertEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.junit.Assert的用法示例。


在下文中一共展示了Assert.assertEquals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: utf_8_char

import org.junit.Assert; //导入方法依赖的package包/类
@Test
public void utf_8_char() throws IOException {
    String content = "; test EditorConfig files with UTF-8 characters larger than 127\r\n" //
            + "\r\n" //

            + "root = true\r\n" //
            + "\r\n" //
            + "[中文.txt]\r\n" //
            + "key = value\r\n" //
            + "";

    final String testFile = "root/中文.txt";
    StringResourceTree tree = StringResourceTree.builder() //
            .resource("root/.editorconfig", content)//
            .touch(testFile) //
            .build();

    Collection<Property> properties = ResourcePropertiesService.default_()
            .queryProperties(tree.getResource(testFile)).getProperties().values();
    Assert.assertEquals(1, properties.size());
    Assert.assertEquals("key = value", properties.iterator().next().toString());
}
 
开发者ID:ec4j,项目名称:ec4j,代码行数:23,代码来源:EditorConfigGlobTest.java

示例2: test_1

import org.junit.Assert; //导入方法依赖的package包/类
public void test_1() throws Exception {
    PropertyFilter filter = new PropertyFilter() {

        public boolean apply(Object source, String name, Object value) {
            if ("id".equals(name)) {
                Assert.assertTrue(value instanceof Long);
                return true;
            }
            return false;
        }
    };

    SerializeWriter out = new SerializeWriter();
    JSONSerializer serializer = new JSONSerializer(out);
    serializer.getPropertyFilters().add(filter);

    A a = new A();
    serializer.write(a);

    String text = out.toString();
    Assert.assertEquals("{\"id\":0}", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:PropertyFilter_long.java

示例3: longCellParsing

import org.junit.Assert; //导入方法依赖的package包/类
@Test
@TestOptions( dataSheet = "TestLong")
public void longCellParsing() throws Exception {

    parser = new ExcelParser(IoUtils.readFile(EXCEL_FILE_PATH), "TestLong");

    Object[][] data = parser.getDataBlock(findMethodByNameOnly("longParseMethod"));

    Assert.assertEquals(data[0][0], 0L);
    Assert.assertEquals(data[1][0], 1234567890123456789L);
    Assert.assertEquals(data[2][0], 9223372036854775807L);
    Assert.assertEquals(data[3][0], 9223372036854775806L);
    Assert.assertEquals(data[4][0], -9223372036854775808L);
    Assert.assertEquals(data[5][0], -9223372036854775807L);
    Assert.assertEquals(data[6][0], 2L);

}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:18,代码来源:Test_ExcelParser_xls.java

示例4: testQueueParsingShouldTrimSpaces

import org.junit.Assert; //导入方法依赖的package包/类
@Test
public void testQueueParsingShouldTrimSpaces() throws Exception {
  CapacitySchedulerConfiguration csConf = 
    new CapacitySchedulerConfiguration();
  setupQueueConfigurationWithSpacesShouldBeTrimmed(csConf);
  YarnConfiguration conf = new YarnConfiguration(csConf);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  capacityScheduler.setConf(conf);
  capacityScheduler.setRMContext(TestUtils.getMockRMContext());
  capacityScheduler.init(conf);
  capacityScheduler.start();
  capacityScheduler.reinitialize(conf, TestUtils.getMockRMContext());
  
  CSQueue a = capacityScheduler.getQueue("a");
  Assert.assertNotNull(a);
  Assert.assertEquals(0.10, a.getAbsoluteCapacity(), DELTA);
  Assert.assertEquals(0.15, a.getAbsoluteMaximumCapacity(), DELTA);
  
  CSQueue c = capacityScheduler.getQueue("c");
  Assert.assertNotNull(c);
  Assert.assertEquals(0.70, c.getAbsoluteCapacity(), DELTA);
  Assert.assertEquals(0.70, c.getAbsoluteMaximumCapacity(), DELTA);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestQueueParsing.java

示例5: testReadBsdiffLong_LongMaxValue

import org.junit.Assert; //导入方法依赖的package包/类
@Test
public void testReadBsdiffLong_LongMaxValue() throws Exception {
  long expected = 0x7fffffffffffffffL;
  long actual =
      BsPatch.readBsdiffLong(
          new ByteArrayInputStream(
              new byte[] {
                (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
                (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x7f
              }));
  Assert.assertEquals(expected, actual);
}
 
开发者ID:lizhangqu,项目名称:CorePatch,代码行数:13,代码来源:BsPatchTest.java

示例6: testItem_0068

import org.junit.Assert; //导入方法依赖的package包/类
public void testItem_0068()
{
  boolean caught;
  caught = false;
  try {
    rc_BigDecimal = (new BigDecimal("3.2E-2147483646")).pow(-1);
  }
  catch (java.lang.ArithmeticException e) {
    caught = true;
  }
  Assert.assertEquals("91.94630872483222%", true, caught);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-systemtest,代码行数:13,代码来源:TestSuite049.java

示例7: testItem_0041

import org.junit.Assert; //导入方法依赖的package包/类
public void testItem_0041()
{
  rc_int = (new BigDecimal("0.00")).signum();
  Assert.assertEquals(0, rc_int);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-systemtest,代码行数:6,代码来源:TestSuite033.java

示例8: testItem_0526

import org.junit.Assert; //导入方法依赖的package包/类
public void testItem_0526()
{
  boolean caught;
  caught = false;
  try {
    rc_BigDecimal = (new BigDecimal("0.0")).divide(new BigDecimal("1"), 1, -2147483648);
  }
  catch (java.lang.IllegalArgumentException e) {
    caught = true;
  }
  Assert.assertEquals("85.57046979865771%", true, caught);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-systemtest,代码行数:13,代码来源:TestSuite001.java

示例9: recover

import org.junit.Assert; //导入方法依赖的package包/类
@Test
public void recover() throws Exception {
    defaultCommitLog.recover();
    Message message = new Message();
    message.getMeta().setTopic("LiQTopic");
    TreeMap<Long, Integer> map = new TreeMap<>();
    for (int i = 0; i < 10; i++) {
        message.setData(("Hello LiQ! " + i).getBytes());
        PutMessageResult result = defaultCommitLog.putMessage(message);
        Assert.assertEquals(PutMessageStatus.PUT_OK,result.getStatus());
        map.put(result.getAppendResult().getWroteOffset(), result.getAppendResult().getWroteBytes());
    }
}
 
开发者ID:taobaorun,项目名称:LiQ,代码行数:14,代码来源:DefaultCommitLogTest.java

示例10: testItem_0853

import org.junit.Assert; //导入方法依赖的package包/类
public void testItem_0853()
{
  boolean caught;
  caught = false;
  try {
    rc_BigDecimal = new BigDecimal("SY1?LJWPT2757;14VS=8Q5G3J5W>L2?6F2T6JKTOXM8K>3U4Y67V>86CT;7KB74WP1L9T4:[email protected]?K15T002N5WTL1S;938KE04", new MathContext("precision=0 roundingMode=HALF_EVEN"));
  }
  catch (java.lang.NumberFormatException e) {
    caught = true;
  }
  Assert.assertEquals("91.61073825503355%", true, caught);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-systemtest,代码行数:13,代码来源:TestSuite014.java

示例11: testItem_0152

import org.junit.Assert; //导入方法依赖的package包/类
public void testItem_0152()
{
  rc_BigDecimal = new BigDecimal(4.9E-324);
  Assert.assertEquals("4.940656458412465441765687928682213723650598026143247644255856825006755072702087518652998363616359923797965646954457177309266567103559397963987747960107818781263007131903114045278458171678489821036887186360569987307230500063874091535649843873124733972731696151400317153853980741262385655911710266585566867681870395603106249319452715914924553293054565444011274801297099995419319894090804165633245247571478690147267801593552386115501348035264934720193790268107107491703332226844753335720832431936092382893458368060106011506169809753078342277318329247904982524730776375927247874656084778203734469699533647017972677717585125660551199131504891101451037862738167250955837389733598993664809941164205702637090279242767544565229087538682506419718265533447265625E-324", rc_BigDecimal.toString());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-systemtest,代码行数:6,代码来源:TestSuite047.java

示例12: testItem_0771

import org.junit.Assert; //导入方法依赖的package包/类
public void testItem_0771()
{
  rc_BigDecimal = (new BigDecimal("-2E+9")).round(new MathContext("precision=1 roundingMode=HALF_UP"));
  Assert.assertEquals("-2E+9", rc_BigDecimal.toString());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-systemtest,代码行数:6,代码来源:TestSuite057.java

示例13: testItem_0748

import org.junit.Assert; //导入方法依赖的package包/类
public void testItem_0748()
{
  rc_BigDecimal = (new BigDecimal("-51200")).round(new MathContext("precision=2147483647 roundingMode=UP"));
  Assert.assertEquals("-51200", rc_BigDecimal.toString());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-systemtest,代码行数:6,代码来源:TestSuite020.java

示例14: testItem_0293

import org.junit.Assert; //导入方法依赖的package包/类
public void testItem_0293()
{
  rc_BigDecimal = (new BigDecimal("1")).abs();
  Assert.assertEquals("1", rc_BigDecimal.toString());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-systemtest,代码行数:6,代码来源:TestSuite006.java

示例15: testItem_0429

import org.junit.Assert; //导入方法依赖的package包/类
public void testItem_0429()
{
  rc_long = (new BigDecimal("9223372036854775807")).longValue();
  Assert.assertEquals(9223372036854775807L, rc_long);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-systemtest,代码行数:6,代码来源:TestSuite021.java


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