本文整理汇总了Java中org.testng.Assert.fail方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.fail方法的具体用法?Java Assert.fail怎么用?Java Assert.fail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.testng.Assert
的用法示例。
在下文中一共展示了Assert.fail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTransform
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public final void testTransform() {
try {
String file = getClass().getResource("CR6905829.xsl").getFile();
Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new File(file)));
System.out.printf("transformer: %s%n", t.getClass().getName());
StringWriter streamResult = new StringWriter();
t.transform(new StreamSource(getClass().getResourceAsStream("CR6905829.xml")), new StreamResult(streamResult));
// expected success
} catch (Exception e) {
// unexpected failure
e.printStackTrace();
Assert.fail(e.toString());
}
}
示例2: test_badTemporalFieldChrono
import org.testng.Assert; //导入方法依赖的package包/类
@Test(dataProvider="calendars")
public void test_badTemporalFieldChrono(Chronology chrono) {
LocalDate refDate = LocalDate.of(2013, 1, 1);
ChronoZonedDateTime<?> czdt = chrono.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC);
for (Chronology[] clist : data_of_calendars()) {
Chronology chrono2 = clist[0];
ChronoZonedDateTime<?> czdt2 = chrono2.date(refDate).atTime(LocalTime.NOON).atZone(ZoneOffset.UTC);
TemporalField adjuster = new FixedTemporalField(czdt2);
if (chrono != chrono2) {
try {
czdt.with(adjuster, 1);
Assert.fail("TemporalField doWith() should have thrown a ClassCastException, " + czdt.getClass()
+ " can not be cast to " + czdt2.getClass());
} catch (ClassCastException cce) {
// Expected exception; not an error
}
} else {
// Same chronology,
ChronoZonedDateTime<?> result = czdt.with(adjuster, 1);
assertEquals(result, czdt2, "TemporalField doWith() failed to replace date");
}
}
}
示例3: testOne
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testOne() {
ErrorHandler errorHandler = new ErrorHandler();
schemaFactory.setErrorHandler(errorHandler);
URL fileName = Bug4996446.class.getResource("Bug4996446.xsd");
try {
schemaFactory.newSchema(fileName);
} catch (SAXException e) {
}
if (errorHandler.errorCounter == 0) {
Assert.fail(" No Errors reported: " + errorHandler.errorCounter);
}
return;
}
示例4: testFilter0004
import org.testng.Assert; //导入方法依赖的package包/类
/**
* Equivalence class partitioning with state, input and output values
* orientation for public Document parse(LSInput is), <br>
* <b>pre-conditions</b>: set filter that accepts all, <br>
* <b>is</b>: xml1 <br>
* <b>output</b>: full XML document.
*/
@Test
public void testFilter0004() {
LSParser parser = createLSParser();
if (parser == null) {
Assert.fail("Unable to create LSParser!");
}
// set filter
parser.setFilter(new LSParserFilter() {
public short startElement(Element elt) {
return FILTER_ACCEPT;
}
public short acceptNode(Node enode) {
return FILTER_ACCEPT;
}
public int getWhatToShow() {
return NodeFilter.SHOW_ALL;
}
});
String expected = "<ROOT><ELEMENT1><CHILD1/><CHILD1><COC1/></CHILD1></ELEMENT1><ELEMENT2>test1<CHILD2/></ELEMENT2></ROOT>";
Document doc = parser.parse(getXmlSource(xml1));
if (!match(expected, doc)) {
Assert.fail("DOM structure after parsing is not equal to a structure of XML document, that being parsed");
}
System.out.println("OKAY");
}
示例5: testXPath30
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testXPath30() throws Exception {
try {
createXPath().evaluate(expression, new InputSource(new StringReader("<root/>")), null);
Assert.fail();
} catch (NullPointerException e) {
; // as expected
}
}
示例6: test1
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void test1() throws SAXException {
try {
ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
validatorHandler.getProperty("unknown1234");
Assert.fail("SAXNotRecognizedException was not thrown.");
} catch (SAXNotRecognizedException e) {
}
}
示例7: testToString
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testToString() {
try {
String inputDateTime = "2006-10-23T22:15:01.000000135+08:00";
DatatypeFactory factory = DatatypeFactory.newInstance();
XMLGregorianCalendar calendar = factory.newXMLGregorianCalendar(inputDateTime);
String toStr = calendar.toString();
Assert.assertTrue(toStr.indexOf("E") == -1, "String value cannot contain exponent");
} catch (DatatypeConfigurationException dce) {
dce.printStackTrace();
Assert.fail("Failed to create instance of DatatypeFactory " + dce.getMessage());
}
}
示例8: testMultiOccursMaxMinOk
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testMultiOccursMaxMinOk() throws Exception {
printMethodName();
File xmlFile = new File(getClass().getResource("multi-occurs-unbounded-ok.xml").getFile());
try {
errorFound = false;
documentBuilder.parse(xmlFile);
} catch (SAXException ex) {
Assert.fail(ex.getMessage());
}
if (errorFound) {
Assert.fail("Unexpected validation error reported");
}
}
示例9: testSplitCDATA001
import org.testng.Assert; //导入方法依赖的package包/类
/**
* Equivalence class partitioning with state and input values orientation
* for public void setParameter(String name, Object value) throws
* DOMException, <br>
* <b>pre-conditions</b>: The root contains a CDATASection with the
* termination marker ']]>', <br>
* <b>name</b>: split-cdata-sections <br>
* <b>value</b>: true. <br>
* <b>Expected results</b>: A warning is reported when the section is
* splitted
*/
@Test
public void testSplitCDATA001() {
DOMImplementation domImpl = null;
try {
domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
} catch (ParserConfigurationException pce) {
Assert.fail(pce.toString());
} catch (FactoryConfigurationError fce) {
Assert.fail(fce.toString());
}
Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
DOMConfiguration config = doc.getDomConfig();
CDATASection cdata = doc.createCDATASection("text]" + "]>text");
doc.getDocumentElement().appendChild(cdata);
TestHandler testHandler = new TestHandler();
config.setParameter("error-handler", testHandler);
if (!config.canSetParameter("split-cdata-sections", Boolean.TRUE)) {
Assert.fail("cannot set the parameters 'split-cdata-sections' to true");
}
config.setParameter("split-cdata-sections", Boolean.TRUE);
doc.normalizeDocument();
if (null == testHandler.getWarning()) {
Assert.fail("no warning is reported");
}
return; // Status.passed("OK");
}
示例10: testFive
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testFive() {
System.out.println("Test StreamWriter's Namespace Context.");
try {
String outputFile = USER_DIR + files[4] + ".out";
System.out.println("Writing output to " + outputFile);
xtw = outputFactory.createXMLStreamWriter(System.out);
xtw.writeStartDocument();
xtw.writeStartElement("elemTwo");
xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
// xtw.writeEndDocument();
NamespaceContext nc = xtw.getNamespaceContext();
// Got a Namespace Context.class
xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
xtw.writeComment("all elements here are explicitly in the HTML namespace");
xtw.setNamespaceContext(nc);
xtw.writeStartDocument("utf-8", "1.0");
// xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
// xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
xtw.writeCharacters("Frobnostication");
xtw.writeEndElement();
xtw.writeEndElement();
xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
xtw.writeCharacters("Moved to");
xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
xtw.writeAttribute("href", "http://frob.com");
xtw.writeCharacters("here");
xtw.writeEndElement();
xtw.writeEndElement();
xtw.writeEndElement();
xtw.writeEndElement();
xtw.writeEndDocument();
xtw.flush();
xtw.close();
Assert.assertTrue(checkResults(outputFile, files[4] + ".org"));
System.out.println("Done");
} catch (Exception ex) {
Assert.fail("testFive Failed " + ex);
ex.printStackTrace();
}
}
示例11: testSuccessPath
import org.testng.Assert; //导入方法依赖的package包/类
/**
* Test succes path for service method <code>getStaffStatusType</code>
*
* Tests expected behaviour of service method.
*/
@Test
public void testSuccessPath() {
Assert.fail( "Test 'SelectionSetService_getStaffStatusTypeTest.testSuccessPath()}' not implemented." );
}
示例12: testSuccessPath
import org.testng.Assert; //导入方法依赖的package包/类
/**
* Test succes path for service method <code>renderCourseCertificates</code>
*
* Tests expected behaviour of service method.
*/
@Test
public void testSuccessPath() {
Assert.fail( "Test 'CourseService_renderCourseCertificatesTest.testSuccessPath()}' not implemented." );
}
示例13: testSuccessPath
import org.testng.Assert; //导入方法依赖的package包/类
/**
* Test succes path for service method <code>setInquiryValues</code>
*
* Tests expected behaviour of service method.
*/
@Test
public void testSuccessPath() {
Assert.fail( "Test 'ProbandService_setInquiryValuesTest.testSuccessPath()}' not implemented." );
}
示例14: testSuccessPath
import org.testng.Assert; //导入方法依赖的package包/类
/**
* Test succes path for service method <code>getCourseInventoryBookingCount</code>
*
* Tests expected behaviour of service method.
*/
@Test
public void testSuccessPath() {
Assert.fail( "Test 'CourseService_getCourseInventoryBookingCountTest.testSuccessPath()}' not implemented." );
}
示例15: testIcdSystVOToEntity
import org.testng.Assert; //导入方法依赖的package包/类
/**
* Test for method icdSystVOToEntity
*
* @see org.phoenixctms.ctsms.domain.IcdSystDao#icdSystVOToEntity(org.phoenixctms.ctsms.vo.IcdSystVO source, org.phoenixctms.ctsms.domain.IcdSyst target, boolean copyIfNull)
*/
@Test
public void testIcdSystVOToEntity() {
Assert.fail("Test 'IcdSystDaoTransformTest.testIcdSystVOToEntity' not implemented!");
}