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


Java Assert.assertFalse方法代码示例

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


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

示例1: testRelink

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testRelink() {
    final DynamicLinkerFactory factory = new DynamicLinkerFactory();
    final DynamicLinker linker = factory.createLinker();
    final MethodType mt = MethodType.methodType(Object.class, Object.class);
    final boolean[] relinkCalled = { Boolean.FALSE };
    final CallSite cs = linker.link(new SimpleRelinkableCallSite(new CallSiteDescriptor(
        MethodHandles.publicLookup(), GET_PROPERTY.named("class"), mt)) {
            @Override
            public void relink(final GuardedInvocation guardedInvocation, final MethodHandle relinkAndInvoke) {
                relinkCalled[0] = Boolean.TRUE;
                super.relink(guardedInvocation, relinkAndInvoke);
            }
        });

    Assert.assertFalse(relinkCalled[0]);
    try {
        cs.getTarget().invoke(new Object());
    } catch (final Throwable th) {}

    Assert.assertTrue(relinkCalled[0]);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:CallSiteTest.java

示例2: after_suite

import org.testng.Assert; //导入方法依赖的package包/类
@AfterSuite
public void after_suite() {
    Assert.assertEquals(orderMethods.size(), 8, "Incorrect size of called methods");

    Assert.assertEquals(orderMethods.get(0), BEFORE_CLASS_BASE, "Incorrect called method by index 0");
    Assert.assertEquals(orderMethods.get(1), BEFORE_CLASS_TEST_PUBLIC, "Incorrect called method by index 1");
    Assert.assertEquals(orderMethods.get(2), BEFORE_METHOD_BASE, "Incorrect called method by index 2");
    Assert.assertEquals(orderMethods.get(3), BEFORE_METHOD_TEST_PUBLIC, "Incorrect called method by index 3");
    Assert.assertEquals(orderMethods.get(4), AFTER_METHOD_TEST_PUBLIC, "Incorrect called method by index 4");
    Assert.assertEquals(orderMethods.get(5), AFTER_METHOD_BASE_PUBLIC, "Incorrect called method by index 5");
    Assert.assertEquals(orderMethods.get(6), AFTER_CLASS_TEST_PUBLIC, "Incorrect called method by index 6");
    Assert.assertEquals(orderMethods.get(7), AFTER_CLASS_BASE_PUBLIC, "Incorrect called method by index 7");

    Assert.assertFalse(orderMethods.contains(BEFORE_CLASS_BASE_PRIVATE), "Private method with @OurBeforeClass from super class was called");
    Assert.assertFalse(orderMethods.contains(BEFORE_METHOD_BASE_PRIVATE), "Private method with @OurBeforeMethod from super class was called");

    Assert.assertFalse(orderMethods.contains(AFTER_METHOD_BASE_PRIVATE), "Private method with @OurAfterMethod from super class was called");
    Assert.assertFalse(orderMethods.contains(AFTER_CLASS_BASE_PRIVATE), "Private method with @OurAfterClass from super class was called");
}
 
开发者ID:WileyLabs,项目名称:teasy,代码行数:20,代码来源:OurBeforeAfterAnnotationsOrderBase.java

示例3: test

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void test() {
    try {
        String xmlFile = "numbering63.xml";
        String xslFile = "numbering63.xsl";

        TransformerFactory tFactory = TransformerFactory.newInstance();
        // tFactory.setAttribute("generate-translet", Boolean.TRUE);
        Transformer t = tFactory.newTransformer(new StreamSource(getClass().getResourceAsStream(xslFile), getClass().getResource(xslFile).toString()));
        StringWriter sw = new StringWriter();
        t.transform(new StreamSource(getClass().getResourceAsStream(xmlFile)), new StreamResult(sw));
        String s = sw.getBuffer().toString();
        Assert.assertFalse(s.contains("1: Level A"));
    } catch (Exception e) {
        Assert.fail(e.getMessage());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Bug6540545.java

示例4: delete

import org.testng.Assert; //导入方法依赖的package包/类
@Test(dependsOnMethods = {"insert"})
public void delete()
{
   String id = UUID.randomUUID().toString();

   try
   {
      hfsDataStore.set(id, new HfsProduct(tmp));
      Product product = hfsDataStore.get(id);

      Assert.assertNotNull(product);
      Assert.assertTrue(product.getName().startsWith("datastore"));

      Assert.assertTrue(product.hasImpl(File.class));
      Assert.assertTrue(product.getImpl(File.class).exists());

      hfsDataStore.delete(id);
      Assert.assertFalse(product.getImpl(File.class).exists());
   }
   catch (DataStoreException e)
   {
      Assert.fail("An exception occurred:", e);
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:25,代码来源:HfsDataStoreTest.java

示例5: testCopy

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testCopy() {
    List<String> groups = asList("foo", "bar", "baz");
    List<GroupOperationType> operations = asList(COUNT, MAX, MIN);
    CachingGroupData data = new CachingGroupData(makeGroups(groups), makeMetrics(operations));

    GroupDataSummary summary = new GroupDataSummary();
    summary.setData(data);

    GroupDataSummary copy = summary.copy();

    Assert.assertFalse(copy == summary);

    GroupData summaryData = summary.getData();
    GroupData copyData = copy.getData();

    // It is a copy
    Assert.assertFalse(copyData == summaryData);
    Assert.assertFalse(copyData.groupFields == summaryData.groupFields);
    Assert.assertFalse(copyData.metrics == summaryData.metrics);

    // But the values are the same
    Assert.assertEquals(copy.isInitialized(), summary.isInitialized());
    Assert.assertEquals(copyData.groupFields, summaryData.groupFields);
    Assert.assertEquals(copyData.metrics, summaryData.metrics);
}
 
开发者ID:yahoo,项目名称:bullet-core,代码行数:27,代码来源:GroupDataSummaryTest.java

示例6: create

import org.testng.Assert; //导入方法依赖的package包/类
@Override
public void create ()
{
   String value = "search_value";
   String complete = "search_complete";
   String footprint = "search_footprint";
   String polygone = "polygone";
   String france = "France";

   Search search = new Search ();
   search.setValue (value);
   search.setComplete (complete);
   search.setFootprint (footprint);
   search.setNotify (false);
   search.getAdvanced ().put (polygone, france);

   search = dao.create (search);
   Assert.assertEquals (dao.count (), (howMany () + 1));
   Assert.assertNotNull (search);
   Assert.assertEquals (search.getAdvanced ().get (polygone), france);
   Assert.assertEquals (search.getComplete (), complete);
   Assert.assertEquals (search.getValue (), value);
   Assert.assertFalse (search.isNotify ());
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:25,代码来源:TestSearchDao.java

示例7: testLoggerAsStringAndLogBackLevelAsInfoWithWrongPackage

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testLoggerAsStringAndLogBackLevelAsInfoWithWrongPackage() {
    Assert.assertNotNull(logbackVerboseConfigurator);
    Assert.assertNotNull(loggerContext);
    logbackVerboseConfigurator.setLoggerLevel("com.paypal.butterfly.cli", Level.INFO);
    Assert.assertFalse(loggerContext.getLogger("com.paypal.butterfly.cli.test").getLevel() == ch.qos.logback.classic.Level.INFO);
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:8,代码来源:LogbackLogConfiguratorTest.java

示例8: testExpressionOnWo

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testExpressionOnWo() {
	
	CmsCI complianceCi = createComplianceCIForExpr(EXPR_WO);
	
	CmsRfcCI rfcCi = new CmsRfcCI();
	rfcCi.setCiClassName("bom.Compute");
	rfcCi.setCiName("compute-1231999");
	rfcCi.addAttribute(createRfcAttribute("size", "M", null));
	rfcCi.addAttribute(createRfcAttribute("ostype", "CentOS 6.5", null));
	CmsWorkOrder wo = new CmsWorkOrder();
	wo.setRfcCi(rfcCi);
	
	Assert.assertTrue(expressionEvaluator.isExpressionMatching(complianceCi, wo));
	
	rfcCi.setCiClassName("bom.oneops.1.Compute");
	Assert.assertTrue(expressionEvaluator.isExpressionMatching(complianceCi, wo));
	
	rfcCi.addAttribute(createRfcAttribute("size", "L", null));
	Assert.assertFalse(expressionEvaluator.isExpressionMatching(complianceCi, wo));
	
	rfcCi.addAttribute(createRfcAttribute("ostype", "CentOS 7.0", null));
	Assert.assertFalse(expressionEvaluator.isExpressionMatching(complianceCi, wo));
	
	CmsRfcCI osRfcCi = new CmsRfcCI();
	osRfcCi.setCiClassName("bom.Os");
	osRfcCi.setCiName("os");
	wo.setRfcCi(osRfcCi);
	
	Assert.assertFalse(expressionEvaluator.isExpressionMatching(complianceCi, wo));
}
 
开发者ID:oneops,项目名称:oneops,代码行数:32,代码来源:ExpressionEvalTest.java

示例9: assertFalse

import org.testng.Assert; //导入方法依赖的package包/类
protected void assertFalse(boolean condition, String errorMessage) {
    try {
        Assert.assertFalse(condition, errorMessage);
    } catch (AssertionError e) {
        TestUtils.fail(e.getMessage());
    }
}
 
开发者ID:WileyLabs,项目名称:teasy,代码行数:8,代码来源:AbstractPageElement.java

示例10: testIsPositive

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testIsPositive() {
    Assert.assertTrue(Validator.isPositive(2.4));
    Assert.assertTrue(Validator.isPositive(2));
    Assert.assertTrue(Validator.isPositive(0.02));
    Assert.assertFalse(Validator.isPositive(-0.3));
}
 
开发者ID:yahoo,项目名称:bullet-core,代码行数:8,代码来源:ValidatorTest.java

示例11: test

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void test() throws ParserConfigurationException {
    DOMImplementation domImpl = DocumentBuilderFactory.newInstance()
            .newDocumentBuilder()
            .getDOMImplementation();

    Assert.assertFalse(domImpl.hasFeature("+XPath", "3.0"));
    Assert.assertEquals(domImpl.getFeature("+XPath", "3.0"), null);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:DOMXPathTest.java

示例12: testAdvanceByScan

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testAdvanceByScan(){
	ListBackedSortedScanner<Integer> scanner = new ListBackedSortedScanner<>(originalList);
	scanner.advanceBy(advanceBy);
	Assert.assertTrue(scanner.advance());
	Assert.assertEquals(scanner.getCurrent().intValue(), 8);
	Assert.assertFalse(scanner.advance());
}
 
开发者ID:hotpads,项目名称:datarouter,代码行数:9,代码来源:ListBackedSortedScannerTests.java

示例13: test1

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void test1() throws Exception {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    dbf.setValidating(true);
    dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
    dbf.setAttribute(SCHEMA_SOURCE, Bug4966142.class.getResource("Bug4966142.xsd").toExternalForm());

    Document document = dbf.newDocumentBuilder().parse(Bug4966142.class.getResource("Bug4966142.xml").toExternalForm());

    TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();

    Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:Bug4966142.java

示例14: testReadWriteObjectForSerialization

import org.testng.Assert; //导入方法依赖的package包/类
@Test
static void testReadWriteObjectForSerialization() throws Throwable {
    MethodHandle readObjectMethod = factory.readObjectForSerialization(Ser.class);
    Assert.assertNotNull(readObjectMethod, "readObjectMethod not found");

    MethodHandle readObjectNoDataMethod = factory.readObjectNoDataForSerialization(Ser.class);
    Assert.assertNotNull(readObjectNoDataMethod, "readObjectNoDataMethod not found");

    MethodHandle writeObjectMethod = factory.writeObjectForSerialization(Ser.class);
    Assert.assertNotNull(writeObjectMethod, "writeObjectMethod not found");

    MethodHandle readResolveMethod = factory.readResolveForSerialization(Ser.class);
    Assert.assertNotNull(readResolveMethod, "readResolveMethod not found");

    MethodHandle writeReplaceMethod = factory.writeReplaceForSerialization(Ser.class);
    Assert.assertNotNull(writeReplaceMethod, "writeReplaceMethod not found");

    byte[] data = null;
    try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos)) {
        Ser ser = new Ser();

        writeReplaceMethod.invoke(ser);
        Assert.assertTrue(ser.writeReplaceCalled, "writeReplace not called");
        Assert.assertFalse(ser.writeObjectCalled, "writeObject should not have been called");

        writeObjectMethod.invoke(ser, oos);
        Assert.assertTrue(ser.writeReplaceCalled, "writeReplace should have been called");
        Assert.assertTrue(ser.writeObjectCalled, "writeObject not called");
        oos.flush();
        data = baos.toByteArray();
    }

    try (ByteArrayInputStream bais = new ByteArrayInputStream(data);
         ObjectInputStream ois = new ObjectInputStream(bais)) {
        Ser ser2 = new Ser();

        readObjectMethod.invoke(ser2, ois);
        Assert.assertTrue(ser2.readObjectCalled, "readObject not called");
        Assert.assertFalse(ser2.readObjectNoDataCalled, "readObjectNoData should not be called");
        Assert.assertFalse(ser2.readResolveCalled, "readResolve should not be called");

        readObjectNoDataMethod.invoke(ser2, ois);
        Assert.assertTrue(ser2.readObjectCalled, "readObject should have been called");
        Assert.assertTrue(ser2.readObjectNoDataCalled, "readObjectNoData not called");
        Assert.assertFalse(ser2.readResolveCalled, "readResolve should not be called");

        readResolveMethod.invoke(ser2);
        Assert.assertTrue(ser2.readObjectCalled, "readObject should have been called");
        Assert.assertTrue(ser2.readObjectNoDataCalled, "readObjectNoData not called");
        Assert.assertTrue(ser2.readResolveCalled, "readResolve not called");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:54,代码来源:ReflectionFactoryTest.java

示例15: testObviousFailure

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testObviousFailure(){
	SortedBeanKey candidate1 = new SortedBeanKey("zzz", "zzz", 55, "zzz");
	Assert.assertTrue(candidate1.compareTo(endOfRange1) > 0);//sanity check
	Assert.assertFalse(FieldSetRangeFilter.include(candidate1, rangeEndInclusive));
}
 
开发者ID:hotpads,项目名称:datarouter,代码行数:7,代码来源:PrefixFieldSetComparatorTests.java


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