當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。