junit 4 api Îĵµ - ÉîÛÚµçÐÅÅàѵÖÐÐÄ.Ð캣òÔÀÏʦ. ·...
TRANSCRIPT
-
ËùÓÐÀàAfterAfterClassAllOfAllTestsAnyOfAssertAssumeBeforeBeforeClassBlockJUnit4ClassRunnerComparisonFailureComputerDescribableDescribedAsDescriptionFailureFilterFilterableIgnoreIsIsAnythingIsEqualIsInstanceOfIsNotIsNullIsSameJUnit4JUnitCoreJUnitMatchersNoTestsRemainExceptionParameterizedParameterized.ParametersParentRunnerRequestResultRuleRunListenerRunnerRunNotifierRunWithSortableSorterStoppedByUserExceptionSuiteSuite.SuiteClassesTestTest.None
-
DeprecatedAPI
DeprecatedMethods
DeprecatedMethodsorg.junit.Assert.assertEquals(double,double)UseassertEquals(doubleexpected,doubleactual,doubleepsilon)insteadorg.junit.Assert.assertEquals(Object[],Object[])useassertArrayEqualsorg.junit.Assert.assertEquals(String,double,double)UseassertEquals(Stringmessage,doubleexpected,doubleactual,doubleepsilon)insteadorg.junit.Assert.assertEquals(String,Object[],Object[])useassertArrayEqualsorg.junit.runner.Request.errorReport(Class,Throwable)org.junit.runners.BlockJUnit4ClassRunner.possiblyExpectingExceptions(FrameworkMethod,Object,Statement)Willbeprivatesoon:useRulesinsteadorg.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(List)unusedAPI,willgoawayinfutureversionorg.junit.runners.BlockJUnit4ClassRunner.withAfters(FrameworkMethod,Object,Statement)Willbeprivatesoon:useRulesinsteadorg.junit.runners.BlockJUnit4ClassRunner.withBefores(FrameworkMethod,Object,Statement)Willbeprivatesoon:useRulesinsteadorg.junit.runners.BlockJUnit4ClassRunner.withPotentialTimeout(FrameworkMethod,Object,Statement)Willbeprivatesoon:useRulesinstead
-
HowThisAPIDocumentIsOrganizedThisAPI(ApplicationProgrammingInterface)documenthaspagescorrespondingtotheitemsinthenavigationbar,describedasfollows.
TheOverviewpageisthefrontpageofthisAPIdocumentandprovidesalistofallpackageswithasummaryforeach.Thispagecanalsocontainanoveralldescriptionofthesetofpackages.
Eachpackagehasapagethatcontainsalistofitsclassesandinterfaces,withasummaryforeach.Thispagecancontainfourcategories:
Interfaces(italic)ClassesEnumsExceptionsErrorsAnnotationTypes
/
Eachclass,interface,nestedclassandnestedinterfacehasitsownseparatepage.Eachofthesepageshasthreesectionsconsistingofaclass/interfacedescription,summarytables,anddetailedmemberdescriptions:
ClassinheritancediagramDirectSubclassesAllKnownSubinterfacesAllKnownImplementingClassesClass/interfacedeclarationClass/interfacedescription
NestedClassSummaryFieldSummary
-
ConstructorSummaryMethodSummary
FieldDetailConstructorDetailMethodDetail
Eachsummaryentrycontainsthefirstsentencefromthedetaileddescriptionforthatitem.Thesummaryentriesarealphabetical,whilethedetaileddescriptionsareintheordertheyappearinthesourcecode.Thispreservesthelogicalgroupingsestablishedbytheprogrammer.
AnnotationType
Eachannotationtypehasitsownseparatepagewiththefollowingsections:
AnnotationTypedeclarationAnnotationTypedescriptionRequiredElementSummaryOptionalElementSummaryElementDetail
Enum
Eachenumhasitsownseparatepagewiththefollowingsections:
EnumdeclarationEnumdescriptionEnumConstantSummaryEnumConstantDetail
()
ThereisaClassHierarchypageforallpackages,plusahierarchyforeachpackage.Eachhierarchypagecontainsalistofclassesandalistofinterfaces.Theclassesareorganizedbyinheritancestructurestartingwithjava.lang.Object.Theinterfacesdonotinheritfromjava.lang.Object.
WhenviewingtheOverviewpage,clickingon"Tree"displaysthe
-
hierarchyforallpackages.Whenviewingaparticularpackage,classorinterfacepage,clicking"Tree"displaysthehierarchyforonlythatpackage.
DeprecatedAPI
TheDeprecatedAPIpagelistsalloftheAPIthathavebeendeprecated.AdeprecatedAPIisnotrecommendedforuse,generallyduetoimprovements,andareplacementAPIisusuallygiven.DeprecatedAPIsmayberemovedinfutureimplementations.
Index
TheIndexcontainsanalphabeticlistofallclasses,interfaces,constructors,methods,andfields.
Prev/Next
Theselinkstakeyoutothenextorpreviousclass,interface,package,orrelatedpage.
Frames/NoFrames
TheselinksshowandhidetheHTMLframes.Allpagesareavailablewithorwithoutframes.
SerializedForm
Eachserializableorexternalizableclasshasadescriptionofitsserializationfieldsandmethods.Thisinformationisofinteresttore-implementors,nottodevelopersusingtheAPI.Whilethereisnolinkinthenavigationbar,youcangettothisinformationbygoingtoanyserializedclassandclicking"SerializedForm"inthe"Seealso"sectionoftheclassdescription.
Thepageliststhestaticfinalfieldsandtheirvalues.
-
ThishelpfileappliestoAPIdocumentationgeneratedusingthestandarddoclet.
-
ABCDEFGHIJMNOPRSTVW
-
A
aClass(Class)-Staticmethodinclassorg.junit.runner.RequestCreateaRequestthat,whenprocessed,willrunallthetestsinaclass.
addChild(Description)-Methodinclassorg.junit.runner.DescriptionAddDescriptionasachildofthereceiver.
addFirstListener(RunListener)-Methodinclassorg.junit.runner.notification.RunNotifier
Internaluseonly.addListener(RunListener)-Methodinclassorg.junit.runner.JUnitCore
Addalistenertobenotifiedasthetestsrun.addListener(RunListener)-Methodinclassorg.junit.runner.notification.RunNotifier
InternaluseonlyAfter-AnnotationTypeinorg.junit
IfyouallocateexternalresourcesinaBeforemethodyouneedtoreleasethemafterthetestruns.
AfterClass-AnnotationTypeinorg.junitIfyouallocateexpensiveexternalresourcesinaBeforeClassmethodyouneedtoreleasethemafterallthetestsintheclasshaverun.
ALL-Staticvariableinclassorg.junit.runner.manipulation.FilterAnullFilterthatpassesallteststhrough.
AllOf-Classinorg.hamcrest.coreCalculatesthelogicalconjunctionoftwomatchers.
AllOf(Iterable)-Constructorforclassorg.junit.runners.AllTests
-
Onlycalledreflectively.any(Class)-Staticmethodinclassorg.hamcrest.core.IsAnything
Thismatcheralwaysevaluatestotrue.AnyOf-Classinorg.hamcrest.core
Calculatesthelogicaldisjunctionoftwomatchers.AnyOf(Iterable
-
Assertsthattwochararraysareequal.assertArrayEquals(char[],char[])-Staticmethodinclassorg.junit.Assert
Assertsthattwochararraysareequal.assertArrayEquals(String,short[],short[])-Staticmethodinclassorg.junit.Assert
Assertsthattwoshortarraysareequal.assertArrayEquals(short[],short[])-Staticmethodinclassorg.junit.Assert
Assertsthattwoshortarraysareequal.assertArrayEquals(String,int[],int[])-Staticmethodinclassorg.junit.Assert
Assertsthattwointarraysareequal.assertArrayEquals(int[],int[])-Staticmethodinclassorg.junit.Assert
Assertsthattwointarraysareequal.assertArrayEquals(String,long[],long[])-Staticmethodinclassorg.junit.Assert
Assertsthattwolongarraysareequal.assertArrayEquals(long[],long[])-Staticmethodinclassorg.junit.Assert
Assertsthattwolongarraysareequal.assertArrayEquals(String,double[],double[],double)-Staticmethodinclassorg.junit.Assert
Assertsthattwodoublearraysareequal.assertArrayEquals(double[],double[],double)-Staticmethodinclassorg.junit.Assert
Assertsthattwodoublearraysareequal.assertArrayEquals(String,float[],float[],float)-Staticmethodinclassorg.junit.Assert
Assertsthattwofloatarraysareequal.assertArrayEquals(float[],float[],float)-Staticmethodinclassorg.junit.Assert
Assertsthattwofloatarraysareequal.assertEquals(String,Object,Object)-Staticmethodinclassorg.junit.Assert
Assertsthattwoobjectsareequal.assertEquals(Object,Object)-Staticmethodinclassorg.junit.Assert
Assertsthattwoobjectsareequal.assertEquals(String,double,double,double)-Staticmethodinclassorg.junit.Assert
Assertsthattwodoublesorfloatsareequaltowithinapositivedelta.assertEquals(long,long)-Staticmethodinclassorg.junit.Assert
Assertsthattwolongsareequal.assertEquals(String,long,long)-Staticmethodinclassorg.junit.Assert
-
Assertsthattwolongsareequal.assertEquals(double,double)-Staticmethodinclassorg.junit.Assert
Deprecated.UseassertEquals(doubleexpected,doubleactual,doubleepsilon)instead
assertEquals(String,double,double)-Staticmethodinclassorg.junit.AssertDeprecated.UseassertEquals(Stringmessage,doubleexpected,doubleactual,doubleepsilon)instead
assertEquals(double,double,double)-Staticmethodinclassorg.junit.AssertAssertsthattwodoublesorfloatsareequaltowithinapositivedelta.
assertEquals(String,Object[],Object[])-Staticmethodinclassorg.junit.Assert
Deprecated.useassertArrayEqualsassertEquals(Object[],Object[])-Staticmethodinclassorg.junit.Assert
Deprecated.useassertArrayEqualsassertFalse(String,boolean)-Staticmethodinclassorg.junit.Assert
Assertsthataconditionisfalse.assertFalse(boolean)-Staticmethodinclassorg.junit.Assert
Assertsthataconditionisfalse.assertNotNull(String,Object)-Staticmethodinclassorg.junit.Assert
Assertsthatanobjectisn'tnull.assertNotNull(Object)-Staticmethodinclassorg.junit.Assert
Assertsthatanobjectisn'tnull.assertNotSame(String,Object,Object)-Staticmethodinclassorg.junit.Assert
Assertsthattwoobjectsdonotrefertothesameobject.assertNotSame(Object,Object)-Staticmethodinclassorg.junit.Assert
Assertsthattwoobjectsdonotrefertothesameobject.assertNull(String,Object)-Staticmethodinclassorg.junit.Assert
Assertsthatanobjectisnull.assertNull(Object)-Staticmethodinclassorg.junit.Assert
Assertsthatanobjectisnull.assertSame(String,Object,Object)-Staticmethodinclassorg.junit.Assert
Assertsthattwoobjectsrefertothesameobject.assertSame(Object,Object)-Staticmethodinclassorg.junit.Assert
Assertsthattwoobjectsrefertothesameobject.assertThat(T,Matcher)-Staticmethodinclassorg.junit.Assert
Assertsthatactualsatisfiestheconditionspecifiedbymatcher.assertThat(String,T,Matcher)-Staticmethodinclassorg.junit.Assert
Assertsthatactualsatisfiestheconditionspecifiedbymatcher.
-
assertTrue(String,boolean)-Staticmethodinclassorg.junit.AssertAssertsthataconditionistrue.
assertTrue(boolean)-Staticmethodinclassorg.junit.AssertAssertsthataconditionistrue.
Assume-Classinorg.junitAsetofmethodsusefulforstatingassumptionsabouttheconditionsinwhichatestismeaningful.
Assume()-Constructorforclassorg.junit.Assume
assumeNoException(Throwable)-Staticmethodinclassorg.junit.AssumeUsetoassumethatanoperationcompletesnormally.
assumeNotNull(Object...)-Staticmethodinclassorg.junit.AssumeIfcalledwithoneormorenullelementsinobjects,thetestwillhaltandbeignored.
assumeThat(T,Matcher)-Staticmethodinclassorg.junit.AssumeCalltoassumethatactualsatisfiestheconditionspecifiedbymatcher.
assumeTrue(boolean)-Staticmethodinclassorg.junit.AssumeIfcalledwithanexpressionevaluatingtofalse,thetestwillhaltandbeignored.
-
B
Before-AnnotationTypeinorg.junitWhenwritingtests,itiscommontofindthatseveraltestsneedsimilarobjectscreatedbeforetheycanrun.
BeforeClass-AnnotationTypeinorg.junitSometimesseveraltestsneedtosharecomputationallyexpensivesetup(likeloggingintoadatabase).
BlockJUnit4ClassRunner-Classinorg.junit.runnersImplementstheJUnit4standardtestcaseclassmodel,asdefinedbytheannotationsintheorg.junitpackage.
BlockJUnit4ClassRunner(Class)-Constructorforclassorg.junit.runners.BlockJUnit4ClassRunner
CreatesaBlockJUnit4ClassRunnertorunklassboth(Matcher)-Staticmethodinclassorg.junit.matchers.JUnitMatchers
Thisisusefulforfluentlycombiningmatchersthatmustbothpass.
-
C
childlessCopy()-Methodinclassorg.junit.runner.Description
childrenInvoker(RunNotifier)-Methodinclassorg.junit.runners.ParentRunner
ReturnsaStatement:CallParentRunner.runChild(Object,RunNotifier)oneachobjectreturnedbyParentRunner.getChildren()(subjecttoanyimposedfilterandsort)
classBlock(RunNotifier)-Methodinclassorg.junit.runners.ParentRunnerConstructsaStatementtorunallofthetestsinthetestclass.
classes(Computer,Class...)-Staticmethodinclassorg.junit.runner.RequestCreateaRequestthat,whenprocessed,willrunallthetestsinasetofclasses.
classes(Class...)-Staticmethodinclassorg.junit.runner.RequestCreateaRequestthat,whenprocessed,willrunallthetestsinasetofclasseswiththedefaultComputer.
classWithoutSuiteMethod(Class)-Staticmethodinclassorg.junit.runner.Request
CreateaRequestthat,whenprocessed,willrunallthetestsinaclass.collectInitializationErrors(List)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors(List)-Methodinclassorg.junit.runners.ParentRunner
Addstoerrorsathrowableforeachproblemnotedwiththetestclass(availablefromParentRunner.getTestClass()).
compare(Description,Description)-Methodinclassorg.junit.runner.manipulation.Sorter
ComparisonFailure-Errorinorg.junit
ThrownwhenanassertEquals(String,String)fails.ComparisonFailure(String,String,String)-Constructorforerrororg.junit.ComparisonFailure
Constructsacomparisonfailure.Computer-Classinorg.junit.runner
Representsastrategyforcomputingrunnersandsuites.
-
Computer()-Constructorforclassorg.junit.runner.Computer
computeTestMethods()-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
Returnsthemethodsthatruntests.containsString(String)-Staticmethodinclassorg.junit.matchers.JUnitMatchers
createListener()-Methodinclassorg.junit.runner.Result
Internaluseonly.createSuiteDescription(String,Annotation...)-Staticmethodinclassorg.junit.runner.Description
CreateaDescriptionnamedname.createSuiteDescription(Class)-Staticmethodinclassorg.junit.runner.Description
CreateaDescriptionnamedaftertestClasscreateTest()-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
Returnsanewfixtureforrunningatest.createTestDescription(Class,String,Annotation...)-Staticmethodinclassorg.junit.runner.Description
CreateaDescriptionofasingletestnamednameintheclassclazz.createTestDescription(Class,String)-Staticmethodinclassorg.junit.runner.Description
CreateaDescriptionofasingletestnamednameintheclassclazz.
-
D
Describable-Interfaceinorg.junit.runnerRepresentsanobjectthatcandescribeitself
describe()-Methodinclassorg.junit.runner.manipulation.FilterReturnsatextualdescriptionofthisFilter
describeChild(FrameworkMethod)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
describeChild(T)-Methodinclassorg.junit.runners.ParentRunner
ReturnsaDescriptionforchild,whichcanbeassumedtobeanelementofthelistreturnedbyParentRunner.getChildren()
describeChild(Runner)-Methodinclassorg.junit.runners.Suite
DescribedAs-Classinorg.hamcrest.coreProvidesacustomdescriptiontoanothermatcher.
DescribedAs(String,Matcher,Object[])-Constructorforclassorg.hamcrest.core.DescribedAs
describedAs(String,Matcher,Object...)-Staticmethodinclassorg.hamcrest.core.DescribedAs
Wrapsanexistingmatcherandoverridesthedescriptionwhenitfails.describeTo(Description)-Methodinclassorg.hamcrest.core.AllOf
describeTo(Description)-Methodinclassorg.hamcrest.core.AnyOf
describeTo(Description)-Methodinclassorg.hamcrest.core.DescribedAs
describeTo(Description)-Methodinclassorg.hamcrest.core.Is
describeTo(Description)-Methodinclassorg.hamcrest.core.IsAnything
describeTo(Description)-Methodinclassorg.hamcrest.core.IsEqual
describeTo(Description)-Methodinclassorg.hamcrest.core.IsInstanceOf
describeTo(Description)-Methodinclassorg.hamcrest.core.IsNot
-
describeTo(Description)-Methodinclassorg.hamcrest.core.IsNull
describeTo(Description)-Methodinclassorg.hamcrest.core.IsSame
-Classinorg.junit.runner
ADescriptiondescribesatestwhichistoberunorhasbeenrun.
-
E
either(Matcher)-Staticmethodinclassorg.junit.matchers.JUnitMatchersThisisusefulforfluentlycombiningmatcherswhereeithermaypass,forexample:
EMPTY-Staticvariableinclassorg.junit.runner.DescriptionDescribesaRunnerwhichrunsnotests
emptySuite()-Staticmethodinclassorg.junit.runners.SuiteReturnsanemptysuite.
equals(Object)-Methodinclassorg.junit.runner.Description
equalTo(T)-Staticmethodinclassorg.hamcrest.core.IsEqualIsthevalueequaltoanothervalue,astestedbytheObject.equals(java.lang.Object)invokedMethod?
errorReport(Class,Throwable)-Staticmethodinclassorg.junit.runner.Request
Deprecated.everyItem(Matcher)-Staticmethodinclassorg.junit.matchers.JUnitMatchers
http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)
-
F
fail(String)-Staticmethodinclassorg.junit.AssertFailsatestwiththegivenmessage.
fail()-Staticmethodinclassorg.junit.AssertFailsatestwithnomessage.
Failure-Classinorg.junit.runner.notificationAFailureholdsadescriptionofthefailedtestandtheexceptionthatwasthrownwhilerunningit.
Failure(Description,Throwable)-Constructorforclassorg.junit.runner.notification.Failure
ConstructsaFailurewiththegivendescriptionandexception.Filter-Classinorg.junit.runner.manipulation
Thecanonicalcaseoffilteringiswhenyouwanttorunasingletestmethodinaclass.
Filter()-Constructorforclassorg.junit.runner.manipulation.Filter
filter(Filter)-Methodininterfaceorg.junit.runner.manipulation.FilterableRemoveteststhatdon'tpasstheparameterfilter.
filter(Filter)-Methodinclassorg.junit.runners.ParentRunner
Filterable-Interfaceinorg.junit.runner.manipulationRunnersthatallowfilteringshouldimplementthisinterface.
filterWith(Filter)-Methodinclassorg.junit.runner.RequestReturnsaRequestthatonlycontainsthoseteststhatshouldrunwhenfilterisapplied
filterWith(Description)-Methodinclassorg.junit.runner.RequestReturnsaRequestthatonlyrunscontainstestswhoseDescriptionequalsdesiredDescription
fireTestAssumptionFailed(Failure)-Methodinclassorg.junit.runner.notification.RunNotifier
Invoketotelllistenersthatanatomictestflaggedthatitassumedsomethingfalse.
fireTestFailure(Failure)-Methodinclassorg.junit.runner.notification.RunNotifier
Invoketotelllistenersthatanatomictestfailed.fireTestFinished(Description)-Methodinclass
-
org.junit.runner.notification.RunNotifierInvoketotelllistenersthatanatomictestfinished.
fireTestIgnored(Description)-Methodinclassorg.junit.runner.notification.RunNotifier
Invoketotelllistenersthatanatomictestwasignored.fireTestRunFinished(Result)-Methodinclassorg.junit.runner.notification.RunNotifier
Donotinvoke.fireTestRunStarted(Description)-Methodinclassorg.junit.runner.notification.RunNotifier
Donotinvoke.fireTestStarted(Description)-Methodinclassorg.junit.runner.notification.RunNotifier
Invoketotelllistenersthatanatomictestisabouttostart.
-
G
getActual()-Methodinerrororg.junit.ComparisonFailureReturnstheactualstringvalue
getAnnotation(Class)-Methodinclassorg.junit.runner.Description
getAnnotations()-Methodinclassorg.junit.runner.Description
getChildren()-Methodinclassorg.junit.runner.Description
getChildren()-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
getChildren()-Methodinclassorg.junit.runners.Parameterized
getChildren()-Methodinclassorg.junit.runners.ParentRunnerReturnsalistofobjectsthatdefinethechildrenofthisRunner.
getChildren()-Methodinclassorg.junit.runners.Suite
getClassName()-Methodinclassorg.junit.runner.Description
getDescription()-Methodininterfaceorg.junit.runner.Describable
getDescription()-Methodinclassorg.junit.runner.notification.Failure
getDescription()-Methodinclassorg.junit.runner.Runner
getDescription()-Methodinclassorg.junit.runners.ParentRunner
getDisplayName()-Methodinclassorg.junit.runner.Description
getException()-Methodinclassorg.junit.runner.notification.Failure
getExpected()-Methodinerrororg.junit.ComparisonFailureReturnstheexpectedstringvalue
getFailureCount()-Methodinclassorg.junit.runner.Result
getFailures()-Methodinclassorg.junit.runner.Result
-
getIgnoreCount()-Methodinclassorg.junit.runner.Result
getMessage()-Methodinerrororg.junit.ComparisonFailure
Returns"..."inplaceofcommonprefixand"..."inplaceofcommonsuffixbetweenexpectedandactual.
getMessage()-Methodinclassorg.junit.runner.notification.FailureConveniencemethod
getMethodName()-Methodinclassorg.junit.runner.Description
getName()-Methodinclassorg.junit.runners.ParentRunnerReturnsanameusedtodescribethisRunner
getRunCount()-Methodinclassorg.junit.runner.Result
getRunner(RunnerBuilder,Class)-Methodinclassorg.junit.runner.Computer
Createasingle-classrunnerfortestClass,usingbuildergetRunner()-Methodinclassorg.junit.runner.Request
ReturnsaRunnerforthisRequestgetRunTime()-Methodinclassorg.junit.runner.Result
getSuite(RunnerBuilder,Class[])-Methodinclassorg.junit.runner.Computer
Createasuiteforclasses,buildingRunnerswithbuilder.getTestClass()-Methodinclassorg.junit.runner.Description
getTestClass()-Methodinclassorg.junit.runners.ParentRunner
ReturnsaTestClassobjectwrappingtheclasstobeexecuted.getTestHeader()-Methodinclassorg.junit.runner.notification.Failure
getTrace()-Methodinclassorg.junit.runner.notification.Failure
ConveniencemethodgetVersion()-Methodinclassorg.junit.runner.JUnitCore
-
H
hashCode()-Methodinclassorg.junit.runner.Description
hasItem(T)-Staticmethodinclassorg.junit.matchers.JUnitMatchers
hasItem(Matcher
-
I
Ignore-AnnotationTypeinorg.junitSometimesyouwanttotemporarilydisableatestoragroupoftests.
instanceOf(Class)-Staticmethodinclassorg.hamcrest.core.IsInstanceOfIsthevalueaninstanceofaparticulartype?
Is-Classinorg.hamcrest.coreDecoratesanotherMatcher,retainingthebehaviorbutallowingteststobeslightlymoreexpressive.
Is(Matcher)-Constructorforclassorg.hamcrest.core.Is
is(Matcher)-Staticmethodinclassorg.hamcrest.core.IsDecoratesanotherMatcher,retainingthebehaviorbutallowingteststobeslightlymoreexpressive.
is(T)-Staticmethodinclassorg.hamcrest.core.IsThisisashortcuttothefrequentlyusedis(equalTo(x)).
is(Class)-Staticmethodinclassorg.hamcrest.core.IsThisisashortcuttothefrequentlyusedis(instanceOf(SomeClass.class)).
IsAnything-Classinorg.hamcrest.coreAmatcherthatalwaysreturnstrue.
IsAnything()-Constructorforclassorg.hamcrest.core.IsAnything
IsAnything(String)-Constructorforclassorg.hamcrest.core.IsAnything
isEmpty()-Methodinclassorg.junit.runner.Description
IsEqual-Classinorg.hamcrest.coreIsthevalueequaltoanothervalue,astestedbytheObject.equals(java.lang.Object)invokedMethod?
IsEqual(T)-Constructorforclassorg.hamcrest.core.IsEqual
IsInstanceOf-Classinorg.hamcrest.coreTestswhetherthevalueisaninstanceofaclass.
IsInstanceOf(Class)-Constructorforclassorg.hamcrest.core.IsInstanceOfCreatesanewinstanceofIsInstanceOf
IsNot-Classinorg.hamcrest.coreCalculatesthelogicalnegationofamatcher.
http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)
-
IsNot(Matcher)-Constructorforclassorg.hamcrest.core.IsNot
IsNull-Classinorg.hamcrest.coreIsthevaluenull?
IsNull()-Constructorforclassorg.hamcrest.core.IsNull
IsSame-Classinorg.hamcrest.coreIsthevaluethesameobjectasanothervalue?
IsSame(T)-Constructorforclassorg.hamcrest.core.IsSame
isSuite()-Methodinclassorg.junit.runner.Description
isTest()-Methodinclassorg.junit.runner.Description
-
J
JUnit4-Classinorg.junit.runnersAliasesthecurrentdefaultJUnit4classrunner,forfuture-proofing.
JUnit4(Class)-Constructorforclassorg.junit.runners.JUnit4Constructsanewinstanceofthedefaultrunner
JUnitCore-Classinorg.junit.runnerJUnitCoreisafacadeforrunningtests.
JUnitCore()-Constructorforclassorg.junit.runner.JUnitCoreCreateanewJUnitCoretoruntests.
JUnitMatchers-Classinorg.junit.matchersConvenienceimportclass:theseareusefulmatchersforusewiththeassertThatmethod,buttheyarenotcurrentlyincludedinthebasicCoreMatchersclassfromhamcrest.
JUnitMatchers()-Constructorforclassorg.junit.matchers.JUnitMatchers
-
M
main(String...)-Staticmethodinclassorg.junit.runner.JUnitCoreRunthetestscontainedintheclassesnamedintheargs.
matches(Object)-Methodinclassorg.hamcrest.core.AllOf
matches(Object)-Methodinclassorg.hamcrest.core.AnyOf
matches(Object)-Methodinclassorg.hamcrest.core.DescribedAs
matches(Object)-Methodinclassorg.hamcrest.core.Is
matches(Object)-Methodinclassorg.hamcrest.core.IsAnything
matches(Object)-Methodinclassorg.hamcrest.core.IsEqual
matches(Object)-Methodinclassorg.hamcrest.core.IsInstanceOf
matches(Object)-Methodinclassorg.hamcrest.core.IsNot
matches(Object)-Methodinclassorg.hamcrest.core.IsNull
matches(Object)-Methodinclassorg.hamcrest.core.IsSame
matchMethodDescription(Description)-Staticmethodinclassorg.junit.runner.manipulation.Filter
ReturnsaFilterthatonlyrunsthesinglemethoddescribedbydesiredDescription
method(Class,String)-Staticmethodinclassorg.junit.runner.RequestCreateaRequestthat,whenprocessed,willrunasingletest.
methodBlock(FrameworkMethod)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
ReturnsaStatementthat,whenexecuted,eitherreturnsnormallyifmethodpasses,orthrowsanexceptionifmethodfails.
methodInvoker(FrameworkMethod,Object)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
ReturnsaStatementthatinvokesmethodontest
-
N
not(Matcher)-Staticmethodinclassorg.hamcrest.core.IsNotInvertstherule.
not(T)-Staticmethodinclassorg.hamcrest.core.IsNotThisisashortcuttothefrequentlyusednot(equalTo(x)).
NoTestsRemainException-Exceptioninorg.junit.runner.manipulationThrownwhenafilterremovesalltestsfromarunner.
NoTestsRemainException()-Constructorforexceptionorg.junit.runner.manipulation.NoTestsRemainException
notNullValue()-Staticmethodinclassorg.hamcrest.core.IsNull
Matchesifvalueisnotnull.notNullValue(Class)-Staticmethodinclassorg.hamcrest.core.IsNull
Matchesifvalueisnotnull.NULL-Staticvariableinclassorg.junit.runner.manipulation.Sorter
NULLisaSorterthatleaveselementsinanundefinedordernullValue()-Staticmethodinclassorg.hamcrest.core.IsNull
Matchesifvalueisnull.nullValue(Class)-Staticmethodinclassorg.hamcrest.core.IsNull
Matchesifvalueisnull.
-
O
org.hamcrest.core-packageorg.hamcrest.coreFundamentalmatchersofobjectsandvalues,andcompositematchers.
org.junit-packageorg.junitProvidesJUnitcoreclassesandannotations.
org.junit.matchers-packageorg.junit.matchersProvidesusefuladditionalMatchersforusewiththeAssert.assertThat(Object,org.hamcrest.Matcher)statement
org.junit.runner-packageorg.junit.runnerProvidesclassesusedtodescribe,collect,runandanalyzemultipletests.
org.junit.runner.manipulation-packageorg.junit.runner.manipulationProvidesclassestofilterorsorttests.
org.junit.runner.notification-packageorg.junit.runner.notificationProvidesinformationaboutatestrun.
org.junit.runners-packageorg.junit.runnersProvidesstandardRunnerimplementations.
-
P
Parameterized-Classinorg.junit.runnersThecustomrunnerParameterizedimplementsparameterizedtests.
Parameterized(Class)-Constructorforclassorg.junit.runners.Parameterized
Onlycalledreflectively.Parameterized.Parameters-AnnotationTypeinorg.junit.runners
AnnotationforamethodwhichprovidesparameterstobeinjectedintothetestclassconstructorbyParameterized
ParentRunner-Classinorg.junit.runnersProvidesmostofthefunctionalityspecifictoaRunnerthatimplementsa"parentnode"inthetesttree,withchildrendefinedbyobjectsofsomedatatypeT.
ParentRunner(Class)-Constructorforclassorg.junit.runners.ParentRunner
ConstructsanewParentRunnerthatwillrun@TestClasspleaseStop()-Methodinclassorg.junit.runner.notification.RunNotifier
Askthatthetestsrunstopbeforestartingthenexttest.possiblyExpectingExceptions(FrameworkMethod,Object,Statement)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
Deprecated.Willbeprivatesoon:useRulesinstead
-
R
removeListener(RunListener)-Methodinclassorg.junit.runner.JUnitCoreRemovealistener.
removeListener(RunListener)-Methodinclassorg.junit.runner.notification.RunNotifier
InternaluseonlyRequest-Classinorg.junit.runner
ARequestisanabstractdescriptionofteststoberun.Request()-Constructorforclassorg.junit.runner.Request
Result-Classinorg.junit.runner
AResultcollectsandsummarizesinformationfromrunningmultipletests.Result()-Constructorforclassorg.junit.runner.Result
Rule-AnnotationTypeinorg.junit
Annotatesfieldsthatcontainrules.rules(Object)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
run(Class...)-Methodinclassorg.junit.runner.JUnitCore
Runallthetestsinclasses.run(Computer,Class...)-Methodinclassorg.junit.runner.JUnitCore
Runallthetestsinclasses.run(Request)-Methodinclassorg.junit.runner.JUnitCore
Runallthetestscontainedinrequest.run(Test)-Methodinclassorg.junit.runner.JUnitCore
RunallthetestscontainedinJUnit3.8.xtest.run(Runner)-Methodinclassorg.junit.runner.JUnitCore
Donotuse.run(RunNotifier)-Methodinclassorg.junit.runner.Runner
Runthetestsforthisrunner.run(RunNotifier)-Methodinclassorg.junit.runners.ParentRunner
runChild(FrameworkMethod,RunNotifier)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
runChild(T,RunNotifier)-Methodinclassorg.junit.runners.ParentRunner
-
Runsthetestcorrespondingtochild,whichcanbeassumedtobeanelementofthelistreturnedbyParentRunner.getChildren().
runChild(Runner,RunNotifier)-Methodinclassorg.junit.runners.Suite
runClasses(Computer,Class...)-Staticmethodinclassorg.junit.runner.JUnitCore
Runthetestscontainedinclasses.runClasses(Class...)-Staticmethodinclassorg.junit.runner.JUnitCore
Runthetestscontainedinclasses.RunListener-Classinorg.junit.runner.notification
Ifyouneedtorespondtotheeventsduringatestrun,extendRunListenerandoverridetheappropriatemethods.
RunListener()-Constructorforclassorg.junit.runner.notification.RunListener
runMain(JUnitSystem,String...)-Methodinclassorg.junit.runner.JUnitCoreDonotuse.
runMainAndExit(JUnitSystem,String...)-Staticmethodinclassorg.junit.runner.JUnitCore
Donotuse.runner(Runner)-Staticmethodinclassorg.junit.runner.Request
Runner-Classinorg.junit.runner
ARunnerrunstestsandnotifiesaRunNotifierofsignificanteventsasitdoesso.
Runner()-Constructorforclassorg.junit.runner.Runner
RunNotifier-Classinorg.junit.runner.notificationIfyouwritecustomrunners,youmayneedtonotifyJUnitofyourprogressrunningtests.
RunNotifier()-Constructorforclassorg.junit.runner.notification.RunNotifier
RunWith-AnnotationTypeinorg.junit.runnerWhenaclassisannotatedwith@RunWithorextendsaclassannotatedwith@RunWith,JUnitwillinvoketheclassitreferencestorunthetestsinthatclassinsteadoftherunnerbuiltintoJUnit.
-
S
sameInstance(T)-Staticmethodinclassorg.hamcrest.core.IsSameCreatesanewinstanceofIsSame
serial()-Staticmethodinclassorg.junit.runner.ComputerReturnsanewdefaultcomputer,whichrunstestsinserialorder
setScheduler(RunnerScheduler)-Methodinclassorg.junit.runners.ParentRunner
Setsaschedulerthatdeterminestheorderandparallelizationofchildren.shouldRun(Description)-Methodinclassorg.junit.runner.manipulation.Filter
sort(Sorter)-Methodininterfaceorg.junit.runner.manipulation.Sortable
Sortsthetestsusingsortersort(Sorter)-Methodinclassorg.junit.runners.ParentRunner
Sortable-Interfaceinorg.junit.runner.manipulation
Interfaceforrunnersthatallowsortingoftests.Sorter-Classinorg.junit.runner.manipulation
ASorterorderstests.Sorter(Comparator)-Constructorforclassorg.junit.runner.manipulation.Sorter
CreatesaSorterthatusescomparatortosorttestssortWith(Comparator)-Methodinclassorg.junit.runner.Request
ReturnsaRequestwhoseTestscanberuninacertainorder,definedbycomparatorForexample,hereiscodetorunatestsuiteinalphabeticalorder:
StoppedByUserException-Exceptioninorg.junit.runner.notificationThrownwhenauserhasrequestedthatthetestrunstop.
StoppedByUserException()-Constructorforexceptionorg.junit.runner.notification.StoppedByUserException
Suite-Classinorg.junit.runners
UsingSuiteasarunnerallowsyoutomanuallybuildasuitecontainingtestsfrommanyclasses.
Suite(Class,RunnerBuilder)-Constructorforclassorg.junit.runners.SuiteCalledreflectivelyonclassesannotatedwith@RunWith(Suite.class)
-
Suite(RunnerBuilder,Class[])-Constructorforclassorg.junit.runners.Suite
Callthiswhenthereisnosinglerootclass(forexample,multipleclassnamespassedonthecommandlinetoJUnitCore
Suite(Class,Class[])-Constructorforclassorg.junit.runners.SuiteCallthiswhenthedefaultbuilderisgoodenough.
Suite(RunnerBuilder,Class,Class[])-Constructorforclassorg.junit.runners.Suite
Calledbythisclassandsubclassesoncetheclassesmakingupthesuitehavebeendetermined
Suite(Class,List)-Constructorforclassorg.junit.runners.SuiteCalledbythisclassandsubclassesoncetherunnersmakingupthesuitehavebeendetermined
Suite.SuiteClasses-AnnotationTypeinorg.junit.runnersTheSuiteClassesannotationspecifiestheclassestoberunwhenaclassannotatedwith@RunWith(Suite.class)isrun.
-
T
Test-AnnotationTypeinorg.junitTheTestannotationtellsJUnitthatthepublicvoidmethodtowhichitisattachedcanberunasatestcase.
Test.None-Classinorg.junitDefaultemptyexception
TEST_MECHANISM-Staticvariableinclassorg.junit.runner.DescriptionDescribesastepinthetest-runningmechanismthatgoessowrongnootherdescriptioncanbeused(forexample,anexceptionthrownfromaRunner'sconstructor
testAssumptionFailure(Failure)-Methodinclassorg.junit.runner.notification.RunListener
CalledwhenanatomictestflagsthatitassumesaconditionthatisfalsetestCount()-Methodinclassorg.junit.runner.Description
testCount()-Methodinclassorg.junit.runner.Runner
testFailure(Failure)-Methodinclassorg.junit.runner.notification.RunListener
Calledwhenanatomictestfails.testFinished(Description)-Methodinclassorg.junit.runner.notification.RunListener
Calledwhenanatomictesthasfinished,whetherthetestsucceedsorfails.testIgnored(Description)-Methodinclassorg.junit.runner.notification.RunListener
Calledwhenatestwillnotberun,generallybecauseatestmethodisannotatedwithIgnore.
testName(FrameworkMethod)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
ReturnsthenamethatdescribesmethodforDescriptions.testRunFinished(Result)-Methodinclassorg.junit.runner.notification.RunListener
CalledwhenalltestshavefinishedtestRunStarted(Description)-Methodinclassorg.junit.runner.notification.RunListener
Calledbeforeanytestshavebeenrun.testStarted(Description)-Methodinclass
-
org.junit.runner.notification.RunListenerCalledwhenanatomictestisabouttobestarted.
toString()-Methodinclassorg.junit.runner.Description
toString()-Methodinclassorg.junit.runner.notification.Failure
-
V
validateConstructor(List)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
Addstoerrorsifthetestclasshasmorethanoneconstructor,oriftheconstructortakesparameters.
validateInstanceMethods(List)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
Deprecated.unusedAPI,willgoawayinfutureversionvalidateOnlyOneConstructor(List)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
Addstoerrorsifthetestclasshasmorethanoneconstructor(donotoverride)
validatePublicVoidNoArgMethods(Class
-
W
wasSuccessful()-Methodinclassorg.junit.runner.Result
withAfterClasses(Statement)-Methodinclassorg.junit.runners.ParentRunnerReturnsaStatement:runallnon-overridden@AfterClassmethodsonthisclassandsuperclassesbeforeexecutingstatement;allAfterClassmethodsarealwaysexecuted:exceptionsthrownbypreviousstepsarecombined,ifnecessary,withexceptionsfromAfterClassmethodsintoaMultipleFailureException.
withAfters(FrameworkMethod,Object,Statement)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
Deprecated.Willbeprivatesoon:useRulesinsteadwithBeforeClasses(Statement)-Methodinclassorg.junit.runners.ParentRunner
ReturnsaStatement:runallnon-overridden@BeforeClassmethodsonthisclassandsuperclassesbeforeexecutingstatement;ifanythrowsanException,stopexecutionandpasstheexceptionon.
withBefores(FrameworkMethod,Object,Statement)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
Deprecated.Willbeprivatesoon:useRulesinsteadwithPotentialTimeout(FrameworkMethod,Object,Statement)-Methodinclassorg.junit.runners.BlockJUnit4ClassRunner
Deprecated.Willbeprivatesoon:useRulesinstead
ABCDEFGHIJMNOPRSTVW
-
org.hamcrest.coreorg.junitorg.junit.matchersorg.junit.runnerorg.junit.runner.manipulationorg.junit.runner.notificationorg.junit.runners
-
..
http://www.sztelecom-edu.com/
-
JUNITAPI4.7JUNIT4API
JUnit4org.hamcrest.core Fundamentalmatchersofobjectsandvalues,andcompositematchers.org.junit ProvidesJUnitcoreclassesandannotations.
org.junit.matchersProvidesusefuladditionalMatchersforusewiththeAssert.assertThat(Object,org.hamcrest.Matcher)statement
org.junit.runner Providesclassesusedtodescribe,collect,runandanalyzemultipletests.org.junit.runner.manipulation Providesclassestofilterorsorttests.org.junit.runner.notification Providesinformationaboutatestrun.org.junit.runners ProvidesstandardRunnerimplementations.
2009www.junit.org, .
http://www.sztelecom-edu.com/
-
HierarchyForAllPackages
PackageHierarchies:org.hamcrest.core,org.junit,org.junit.matchers,org.junit.runner,org.junit.runner.manipulation,org.junit.runner.notification,org.junit.runners
-
ClassHierarchy
java.lang.Objectorg.junit.Assertorg.junit.Assumeorg.hamcrest.BaseMatcher(implementsorg.hamcrest.Matcher)
org.hamcrest.core.AllOforg.hamcrest.core.AnyOforg.hamcrest.core.DescribedAsorg.hamcrest.core.Isorg.hamcrest.core.IsAnythingorg.hamcrest.core.IsEqualorg.hamcrest.core.IsInstanceOforg.hamcrest.core.IsNotorg.hamcrest.core.IsNullorg.hamcrest.core.IsSame
org.junit.runner.Computerorg.junit.runner.org.junit.runner.notification.Failureorg.junit.runner.manipulation.Filterorg.junit.runner.JUnitCoreorg.junit.matchers.JUnitMatchersorg.junit.runner.Requestorg.junit.runner.Resultorg.junit.runner.notification.RunListenerorg.junit.runner.Runner(implementsorg.junit.runner.Describable)
org.junit.internal.runners.JUnit38ClassRunner(implementsorg.junit.runner.manipulation.Filterable,org.junit.runner.manipulation.Sortable)
org.junit.internal.runners.SuiteMethodorg.junit.runners.AllTests
org.junit.runners.ParentRunner(implementsorg.junit.runner.manipulation.Filterable,org.junit.runner.manipulation.Sortable)
org.junit.runners.BlockJUnit4ClassRunnerorg.junit.runners.JUnit4
http://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
org.junit.runners.Suiteorg.junit.runners.Parameterized
org.junit.runner.notification.RunNotifierorg.junit.runner.manipulation.Sorter(implementsjava.util.Comparator)java.lang.Throwable(implementsjava.io.Serializable)
java.lang.Errorjava.lang.AssertionError
org.junit.ComparisonFailurejava.lang.
org.junit.runner.manipulation.NoTestsRemainExceptionjava.lang.RuntimeException
org.junit.runner.notification.StoppedByUserExceptionorg.junit.Test.None
http://java.sun.com/javase/6/docs/api/java/util/Comparator.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Throwable.htmlhttp://java.sun.com/javase/6/docs/api/java/io/Serializable.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Error.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Exception.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/RuntimeException.html
-
InterfaceHierarchy
org.junit.runner.Describableorg.junit.runner.manipulation.Filterableorg.junit.runner.manipulation.Sortable
-
AnnotationTypeHierarchy
org.junit.Test(implementsjava.lang.annotation.Annotation)org.junit.Rule(implementsjava.lang.annotation.Annotation)org.junit.Ignore(implementsjava.lang.annotation.Annotation)org.junit.BeforeClass(implementsjava.lang.annotation.Annotation)org.junit.Before(implementsjava.lang.annotation.Annotation)org.junit.AfterClass(implementsjava.lang.annotation.Annotation)org.junit.After(implementsjava.lang.annotation.Annotation)org.junit.runner.RunWith(implementsjava.lang.annotation.Annotation)org.junit.runners.Suite.SuiteClasses(implementsjava.lang.annotation.Annotation)org.junit.runners.Parameterized.Parameters(implementsjava.lang.annotation.Annotation)
http://java.sun.com/javase/6/docs/api/java/lang/annotation/Annotation.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Annotation.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Annotation.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Annotation.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Annotation.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Annotation.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Annotation.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Annotation.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Annotation.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Annotation.html
-
SerializedForm
org.junit
Classorg.junit.ComparisonFailureextendsAssertionErrorimplementsSerializable
serialVersionUID:1L
SerializedFields
fExpected
StringfExpected
fActual
StringfActual
Classorg.junit.Test.NoneextendsThrowableimplementsSerializable
serialVersionUID:1L
org.junit.runner.manipulation
Classorg.junit.runner.manipulation.NoTestsRemainExceptionextendsExceptionimplementsSerializable
http://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Throwable.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Exception.html
-
serialVersionUID:1L
org.junit.runner.notification
Classorg.junit.runner.notification.StoppedByUserExceptionextendsRuntimeExceptionimplementsSerializable
serialVersionUID:1L
http://java.sun.com/javase/6/docs/api/java/lang/RuntimeException.html
-
:|| | :| |
-
org.hamcrest.coreClassAllOfjava.lang.Object org.hamcrest.BaseMatcher org.hamcrest.core.AllOf
:org.hamcrest.Matcher,org.hamcrest.SelfDescribing
publicclassAllOf
extendsorg.hamcrest.BaseMatcher
Calculatesthelogicalconjunctionoftwomatchers.Evaluationisshortcut,sothatthesecondmatcherisnotcalledifthefirstmatcherreturnsfalse.
AllOf(Iterable
-
java.lang. Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,wait,wait,wait
AllOf
publicAllOf(Iterable
-
Descriptioncopiedfrominterface:org.hamcrest.SelfDescribingGeneratesadescriptionoftheobject.Thedescriptionmaybepartofaadescriptionofalargerobjectofwhichthisisjustacomponent,soitshouldbewordedappropriately.
:description-Thedescriptiontobebuiltorappendedto.
allOf
publicstaticorg.hamcrest.MatcherallOf(org.hamcrest.Matcher
-
:|| | :| |
-
org.hamcrest.coreClassAnyOfjava.lang.Object org.hamcrest.BaseMatcher org.hamcrest.core.AnyOf
:org.hamcrest.Matcher,org.hamcrest.SelfDescribing
publicclassAnyOf
extendsorg.hamcrest.BaseMatcher
Calculatesthelogicaldisjunctionoftwomatchers.Evaluationisshortcut,sothatthesecondmatcherisnotcalledifthefirstmatcherreturnstrue.
AnyOf(Iterable
-
java.lang. Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,wait,wait,wait
AnyOf
publicAnyOf(Iterable
-
Descriptioncopiedfrominterface:org.hamcrest.SelfDescribingGeneratesadescriptionoftheobject.Thedescriptionmaybepartofaadescriptionofalargerobjectofwhichthisisjustacomponent,soitshouldbewordedappropriately.
:description-Thedescriptiontobebuiltorappendedto.
anyOf
publicstaticorg.hamcrest.MatcheranyOf(org.hamcrest.Matcher
-
:|| | :| |
-
org.hamcrest.coreClassDescribedAsjava.lang.Object org.hamcrest.BaseMatcher org.hamcrest.core.DescribedAs
:org.hamcrest.Matcher,org.hamcrest.SelfDescribing
publicclassDescribedAs
extendsorg.hamcrest.BaseMatcher
Providesacustomdescriptiontoanothermatcher.
DescribedAs(StringdescriptionTemplate,org.hamcrest.Matchermatcher,Object[]values)
static
org.hamcrest.Matcher
describedAs(Stringdescription,org.hamcrest.Matchermatcher,Object...values)Wrapsanexistingmatcherandoverridesthedescriptionwhenitfails.voiddescribeTo(org.hamcrest.Descriptiondescription)Generatesadescriptionoftheobject.booleanmatches(Objecto)Evaluatesthematcherforargumentitem.org.hamcrest.BaseMatcher_dont_implement_Matcher___instead_extend_BaseMatcher_,toString
java.lang. Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,wait,wait,wait
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#finalize()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#getClass()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long, int)
-
DescribedAs
publicDescribedAs(StringdescriptionTemplate,org.hamcrest.Matchermatcher,Object[]values)
matches
publicbooleanmatches(Objecto)
Descriptioncopiedfrominterface:org.hamcrest.MatcherEvaluatesthematcherforargumentitem.
ThismethodmatchesagainstObject,insteadofthegenerictypeT.ThisisbecausethecalleroftheMatcherdoesnotknowatruntimewhatthetypeis(becauseoftypeerasurewithJavagenerics).Itisdowntotheimplementationstocheckthecorrecttype.
:o-theobjectagainstwhichthematcherisevaluated.
:trueifitemmatches,otherwisefalse.
:BaseMatcher
describeTo
publicvoiddescribeTo(org.hamcrest.Descriptiondescription)
Descriptioncopiedfrominterface:org.hamcrest.SelfDescribingGeneratesadescriptionoftheobject.Thedescriptionmaybepartofaadescriptionofalargerobjectofwhichthisisjustacomponent,soitshould
http://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
bewordedappropriately.
:description-Thedescriptiontobebuiltorappendedto.
describedAs
publicstaticorg.hamcrest.MatcherdescribedAs(Stringdescription,org.hamcrest.Matchermatcher,Object...values)
Wrapsanexistingmatcherandoverridesthedescriptionwhenitfails.
:|| | :| |
http://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
:|| | :| |
-
org.hamcrest.coreClassIsjava.lang.Object org.hamcrest.BaseMatcher org.hamcrest.core.Is
:org.hamcrest.Matcher,org.hamcrest.SelfDescribing
publicclassIs
extendsorg.hamcrest.BaseMatcher
DecoratesanotherMatcher,retainingthebehaviorbutallowingteststobeslightlymoreexpressive.eg.assertThat(cheese,equalTo(smelly))vsassertThat(cheese,is(equalTo(smelly)))
Is(org.hamcrest.Matchermatcher)
voiddescribeTo(org.hamcrest.Descriptiondescription)Generatesadescriptionoftheobject.
staticorg.hamcrest.Matcheris(Classtype)Thisisashortcuttothefrequentlyusedis(instanceOf(SomeClass.class)).
static
org.hamcrest.Matcher
is(org.hamcrest.Matchermatcher)DecoratesanotherMatcher,retainingthebehaviorbutallowingteststobeslightlymoreexpressive.
static
org.hamcrest.Matcher
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Class.html
-
is(Tvalue)Thisisashortcuttothefrequentlyusedis(equalTo(x)).booleanmatches(Objectarg)Evaluatesthematcherforargumentitem.org.hamcrest.BaseMatcher_dont_implement_Matcher___instead_extend_BaseMatcher_,toString
java.lang. Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,wait,wait,wait
Is
publicIs(org.hamcrest.Matchermatcher)
matches
publicbooleanmatches(Objectarg)
Descriptioncopiedfrominterface:org.hamcrest.MatcherEvaluatesthematcherforargumentitem.
ThismethodmatchesagainstObject,insteadofthegenerictypeT.ThisisbecausethecalleroftheMatcherdoesnotknowatruntimewhatthetypeis(becauseoftypeerasurewithJavagenerics).Itisdowntotheimplementationstocheckthecorrecttype.
:arg-theobjectagainstwhichthematcherisevaluated.
:trueifitemmatches,otherwisefalse.
:
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#finalize()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#getClass()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long, int)http://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
BaseMatcher
describeTo
publicvoiddescribeTo(org.hamcrest.Descriptiondescription)
Descriptioncopiedfrominterface:org.hamcrest.SelfDescribingGeneratesadescriptionoftheobject.Thedescriptionmaybepartofaadescriptionofalargerobjectofwhichthisisjustacomponent,soitshouldbewordedappropriately.
:description-Thedescriptiontobebuiltorappendedto.
is
publicstaticorg.hamcrest.Matcheris(org.hamcrest.Matchermatcher)
DecoratesanotherMatcher,retainingthebehaviorbutallowingteststobeslightlymoreexpressive.eg.assertThat(cheese,equalTo(smelly))vsassertThat(cheese,is(equalTo(smelly)))
is
publicstaticorg.hamcrest.Matcheris(Tvalue)
Thisisashortcuttothefrequentlyusedis(equalTo(x)).eg.assertThat(cheese,is(equalTo(smelly)))vsassertThat(cheese,is(smelly))
is
publicstaticorg.hamcrest.Matcheris(Classtype)
Thisisashortcuttothefrequentlyusedis(instanceOf(SomeClass.class)).eg.assertThat(cheese,is(instanceOf(Cheddar.class)))vsassertThat(cheese,is(Cheddar.class))
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Class.html
-
:|| | :| |
-
:|| | :| |
-
org.hamcrest.coreClassIsAnythingjava.lang.Object org.hamcrest.BaseMatcher org.hamcrest.core.IsAnything
:org.hamcrest.Matcher,org.hamcrest.SelfDescribing
publicclassIsAnything
extendsorg.hamcrest.BaseMatcher
Amatcherthatalwaysreturnstrue.
IsAnything()IsAnything(Stringdescription)
static
org.hamcrest.Matcher
any(Classtype)Thismatcheralwaysevaluatestotrue.
static
org.hamcrest.Matcher
anything()Thismatcheralwaysevaluatestotrue.static
org.hamcrest.Matcher
anything(Stringdescription)Thismatcheralwaysevaluatestotrue.voiddescribeTo(org.hamcrest.Descriptiondescription)
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Class.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.html
-
Generatesadescriptionoftheobject.booleanmatches(Objecto)Evaluatesthematcherforargumentitem.org.hamcrest.BaseMatcher_dont_implement_Matcher___instead_extend_BaseMatcher_,toString
java.lang. Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,wait,wait,wait
IsAnything
publicIsAnything()
IsAnything
publicIsAnything(Stringdescription)
matches
publicbooleanmatches(Objecto)
Descriptioncopiedfrominterface:org.hamcrest.MatcherEvaluatesthematcherforargumentitem.
ThismethodmatchesagainstObject,insteadofthegenerictypeT.ThisisbecausethecalleroftheMatcherdoesnotknowatruntimewhatthetypeis(becauseoftypeerasurewithJavagenerics).Itisdowntotheimplementationstocheckthecorrecttype.
:o-theobjectagainstwhichthematcherisevaluated.
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#finalize()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#getClass()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long, int)http://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
:trueifitemmatches,otherwisefalse.
:BaseMatcher
describeTo
publicvoiddescribeTo(org.hamcrest.Descriptiondescription)
Descriptioncopiedfrominterface:org.hamcrest.SelfDescribingGeneratesadescriptionoftheobject.Thedescriptionmaybepartofaadescriptionofalargerobjectofwhichthisisjustacomponent,soitshouldbewordedappropriately.
:description-Thedescriptiontobebuiltorappendedto.
anything
publicstaticorg.hamcrest.Matcheranything()
Thismatcheralwaysevaluatestotrue.
anything
publicstaticorg.hamcrest.Matcheranything(Stringdescription)
Thismatcheralwaysevaluatestotrue.
:description-Ameaningfulstringusedwhendescribingitself.
any
publicstaticorg.hamcrest.Matcherany(Classtype)
http://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Class.html
-
Thismatcheralwaysevaluatestotrue.Withtypeinference.
:|| | :| |
-
:|| | :| |
-
org.hamcrest.coreClassIsEqualjava.lang.Object org.hamcrest.BaseMatcher org.hamcrest.core.IsEqual
:org.hamcrest.Matcher,org.hamcrest.SelfDescribing
publicclassIsEqual
extendsorg.hamcrest.BaseMatcher
Isthevalueequaltoanothervalue,astestedbytheObject.equals(java.lang.Object)invokedMethod?
IsEqual(TequalArg)
voiddescribeTo(org.hamcrest.Descriptiondescription)Generatesadescriptionoftheobject.
static
org.hamcrest.Matcher
equalTo(Toperand)Isthevalueequaltoanothervalue,astestedbytheObject.equals(java.lang.Object)invokedMethod?booleanmatches(Objectarg)Evaluatesthematcherforargumentitem.org.hamcrest.BaseMatcher_dont_implement_Matcher___instead_extend_BaseMatcher_,toString
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)http://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
java.lang. Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,wait,wait,wait
IsEqual
publicIsEqual(TequalArg)
matches
publicbooleanmatches(Objectarg)
Descriptioncopiedfrominterface:org.hamcrest.MatcherEvaluatesthematcherforargumentitem.
ThismethodmatchesagainstObject,insteadofthegenerictypeT.ThisisbecausethecalleroftheMatcherdoesnotknowatruntimewhatthetypeis(becauseoftypeerasurewithJavagenerics).Itisdowntotheimplementationstocheckthecorrecttype.
:arg-theobjectagainstwhichthematcherisevaluated.
:trueifitemmatches,otherwisefalse.
:BaseMatcher
describeTo
publicvoiddescribeTo(org.hamcrest.Descriptiondescription)
Descriptioncopiedfrominterface:org.hamcrest.SelfDescribing
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#finalize()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#getClass()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long, int)http://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
Generatesadescriptionoftheobject.Thedescriptionmaybepartofaadescriptionofalargerobjectofwhichthisisjustacomponent,soitshouldbewordedappropriately.
:description-Thedescriptiontobebuiltorappendedto.
equalTo
publicstaticorg.hamcrest.MatcherequalTo(Toperand)
Isthevalueequaltoanothervalue,astestedbytheObject.equals(java.lang.Object)invokedMethod?
:|| | :| |
http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)
-
:|| | :| |
-
org.hamcrest.coreClassIsInstanceOfjava.lang.Object org.hamcrest.BaseMatcher org.hamcrest.core.IsInstanceOf
:org.hamcrest.Matcher,org.hamcrest.SelfDescribing
publicclassIsInstanceOf
extendsorg.hamcrest.BaseMatcher
Testswhetherthevalueisaninstanceofaclass.
IsInstanceOf(ClasstheClass)CreatesanewinstanceofIsInstanceOf
voiddescribeTo(org.hamcrest.Descriptiondescription)Generatesadescriptionoftheobject.
staticorg.hamcrest.MatcherinstanceOf(Classtype)Isthevalueaninstanceofaparticulartype?
booleanmatches(Objectitem)Evaluatesthematcherforargumentitem.
org.hamcrest.BaseMatcher_dont_implement_Matcher___instead_extend_BaseMatcher_,toString
java.lang. Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,wait,wait,wait
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Class.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Class.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#finalize()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#getClass()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long, int)
-
IsInstanceOf
publicIsInstanceOf(ClasstheClass)
CreatesanewinstanceofIsInstanceOf
:theClass-Thepredicateevaluatestotrueforinstancesofthisclassoroneofitssubclasses.
matches
publicbooleanmatches(Objectitem)
Descriptioncopiedfrominterface:org.hamcrest.MatcherEvaluatesthematcherforargumentitem.
ThismethodmatchesagainstObject,insteadofthegenerictypeT.ThisisbecausethecalleroftheMatcherdoesnotknowatruntimewhatthetypeis(becauseoftypeerasurewithJavagenerics).Itisdowntotheimplementationstocheckthecorrecttype.
:item-theobjectagainstwhichthematcherisevaluated.
:trueifitemmatches,otherwisefalse.
:BaseMatcher
describeTo
http://java.sun.com/javase/6/docs/api/java/lang/Class.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
publicvoiddescribeTo(org.hamcrest.Descriptiondescription)
Descriptioncopiedfrominterface:org.hamcrest.SelfDescribingGeneratesadescriptionoftheobject.Thedescriptionmaybepartofaadescriptionofalargerobjectofwhichthisisjustacomponent,soitshouldbewordedappropriately.
:description-Thedescriptiontobebuiltorappendedto.
instanceOf
publicstaticorg.hamcrest.MatcherinstanceOf(Classtype)
Isthevalueaninstanceofaparticulartype?
:|| | :| |
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Class.html
-
:|| | :| |
-
org.hamcrest.coreClassIsNotjava.lang.Object org.hamcrest.BaseMatcher org.hamcrest.core.IsNot
:org.hamcrest.Matcher,org.hamcrest.SelfDescribing
publicclassIsNot
extendsorg.hamcrest.BaseMatcher
Calculatesthelogicalnegationofamatcher.
IsNot(org.hamcrest.Matchermatcher)
voiddescribeTo(org.hamcrest.Descriptiondescription)Generatesadescriptionoftheobject.
booleanmatches(Objectarg)Evaluatesthematcherforargumentitem.
static
org.hamcrest.Matcher
not(org.hamcrest.Matchermatcher)Invertstherule.
static
org.hamcrest.Matcher
not(Tvalue)Thisisashortcuttothefrequentlyusednot(equalTo(x)).org.hamcrest.BaseMatcher
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
_dont_implement_Matcher___instead_extend_BaseMatcher_,toString
java.lang. Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,wait,wait,wait
IsNot
publicIsNot(org.hamcrest.Matchermatcher)
matches
publicbooleanmatches(Objectarg)
Descriptioncopiedfrominterface:org.hamcrest.MatcherEvaluatesthematcherforargumentitem.
ThismethodmatchesagainstObject,insteadofthegenerictypeT.ThisisbecausethecalleroftheMatcherdoesnotknowatruntimewhatthetypeis(becauseoftypeerasurewithJavagenerics).Itisdowntotheimplementationstocheckthecorrecttype.
:arg-theobjectagainstwhichthematcherisevaluated.
:trueifitemmatches,otherwisefalse.
:BaseMatcher
describeTo
publicvoiddescribeTo(org.hamcrest.Descriptiondescription)
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#finalize()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#getClass()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long, int)http://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
Descriptioncopiedfrominterface:org.hamcrest.SelfDescribingGeneratesadescriptionoftheobject.Thedescriptionmaybepartofaadescriptionofalargerobjectofwhichthisisjustacomponent,soitshouldbewordedappropriately.
:description-Thedescriptiontobebuiltorappendedto.
not
publicstaticorg.hamcrest.Matchernot(org.hamcrest.Matchermatcher)
Invertstherule.
not
publicstaticorg.hamcrest.Matchernot(Tvalue)
Thisisashortcuttothefrequentlyusednot(equalTo(x)).eg.assertThat(cheese,is(not(equalTo(smelly))))vsassertThat(cheese,is(not(smelly)))
:|| | :| |
-
:|| | :| |
-
org.hamcrest.coreClassIsNulljava.lang.Object org.hamcrest.BaseMatcher org.hamcrest.core.IsNull
:org.hamcrest.Matcher,org.hamcrest.SelfDescribing
publicclassIsNull
extendsorg.hamcrest.BaseMatcher
Isthevaluenull?
IsNull()
voiddescribeTo(org.hamcrest.Descriptiondescription)Generatesadescriptionoftheobject.
booleanmatches(Objecto)Evaluatesthematcherforargumentitem.
static
org.hamcrest.Matcher
notNullValue()Matchesifvalueisnotnull.
static
org.hamcrest.Matcher
notNullValue(Classtype)Matchesifvalueisnotnull.static
org.hamcrest.Matcher
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Class.html
-
nullValue()Matchesifvalueisnull.static
org.hamcrest.Matcher
nullValue(Classtype)Matchesifvalueisnull.org.hamcrest.BaseMatcher_dont_implement_Matcher___instead_extend_BaseMatcher_,toString
java.lang. Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,wait,wait,wait
IsNull
publicIsNull()
matches
publicbooleanmatches(Objecto)
Descriptioncopiedfrominterface:org.hamcrest.MatcherEvaluatesthematcherforargumentitem.
ThismethodmatchesagainstObject,insteadofthegenerictypeT.ThisisbecausethecalleroftheMatcherdoesnotknowatruntimewhatthetypeis(becauseoftypeerasurewithJavagenerics).Itisdowntotheimplementationstocheckthecorrecttype.
:o-theobjectagainstwhichthematcherisevaluated.
:trueifitemmatches,otherwisefalse.
http://java.sun.com/javase/6/docs/api/java/lang/Class.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#finalize()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#getClass()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long, int)http://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
:BaseMatcher
describeTo
publicvoiddescribeTo(org.hamcrest.Descriptiondescription)
Descriptioncopiedfrominterface:org.hamcrest.SelfDescribingGeneratesadescriptionoftheobject.Thedescriptionmaybepartofaadescriptionofalargerobjectofwhichthisisjustacomponent,soitshouldbewordedappropriately.
:description-Thedescriptiontobebuiltorappendedto.
nullValue
publicstaticorg.hamcrest.MatchernullValue()
Matchesifvalueisnull.
notNullValue
publicstaticorg.hamcrest.MatchernotNullValue()
Matchesifvalueisnotnull.
nullValue
publicstaticorg.hamcrest.MatchernullValue(Classtype)
Matchesifvalueisnull.Withtypeinference.
notNullValue
http://java.sun.com/javase/6/docs/api/java/lang/Class.html
-
publicstaticorg.hamcrest.MatchernotNullValue(Classtype)
Matchesifvalueisnotnull.Withtypeinference.
:|| | :| |
http://java.sun.com/javase/6/docs/api/java/lang/Class.html
-
CLASS
:|| | :| |
-
org.hamcrest.coreClassIsSamejava.lang.Object org.hamcrest.BaseMatcher org.hamcrest.core.IsSame
:org.hamcrest.Matcher,org.hamcrest.SelfDescribing
publicclassIsSame
extendsorg.hamcrest.BaseMatcher
Isthevaluethesameobjectasanothervalue?
IsSame(Tobject)
voiddescribeTo(org.hamcrest.Descriptiondescription)Generatesadescriptionoftheobject.
booleanmatches(Objectarg)Evaluatesthematcherforargumentitem.
static
org.hamcrest.Matcher
sameInstance(Tobject)CreatesanewinstanceofIsSameorg.hamcrest.BaseMatcher_dont_implement_Matcher___instead_extend_BaseMatcher_,toString
java.lang. Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#finalize()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#getClass()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()
-
wait,wait,wait
IsSame
publicIsSame(Tobject)
matches
publicbooleanmatches(Objectarg)
Descriptioncopiedfrominterface:org.hamcrest.MatcherEvaluatesthematcherforargumentitem.
ThismethodmatchesagainstObject,insteadofthegenerictypeT.ThisisbecausethecalleroftheMatcherdoesnotknowatruntimewhatthetypeis(becauseoftypeerasurewithJavagenerics).Itisdowntotheimplementationstocheckthecorrecttype.
:arg-theobjectagainstwhichthematcherisevaluated.
:trueifitemmatches,otherwisefalse.
:BaseMatcher
describeTo
publicvoiddescribeTo(org.hamcrest.Descriptiondescription)
Descriptioncopiedfrominterface:org.hamcrest.SelfDescribingGeneratesadescriptionoftheobject.Thedescriptionmaybepartofaadescriptionofalargerobjectofwhichthisisjustacomponent,soitshould
http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long, int)http://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
bewordedappropriately.
:description-Thedescriptiontobebuiltorappendedto.
sameInstance
publicstaticorg.hamcrest.MatchersameInstance(Tobject)
CreatesanewinstanceofIsSame
:object-Thepredicateevaluatestotrueonlywhentheargumentisthisobject.
CLASS
:|| | :| |
-
org.hamcrest.coreÀàAllOfAnyOfDescribedAsIsIsAnythingIsEqualIsInstanceOfIsNotIsNullIsSame
-
Packageorg.hamcrest.core
Fundamentalmatchersofobjectsandvalues,andcompositematchers.
:
AllOf Calculatesthelogicalconjunctionoftwomatchers.AnyOf Calculatesthelogicaldisjunctionoftwomatchers.DescribedAs Providesacustomdescriptiontoanothermatcher.
Is DecoratesanotherMatcher,retainingthebehaviorbutallowingteststobeslightlymoreexpressive.IsAnything Amatcherthatalwaysreturnstrue.
IsEqual Isthevalueequaltoanothervalue,astestedbytheObject.equals(java.lang.Object)invokedMethod?
IsInstanceOf Testswhetherthevalueisaninstanceofaclass.IsNot Calculatesthelogicalnegationofamatcher.IsNull Isthevaluenull?IsSame Isthevaluethesameobjectasanothervalue?
http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)
-
Packageorg.hamcrest.coreDescription
Fundamentalmatchersofobjectsandvalues,andcompositematchers.
-
NEXT
-
HierarchyForPackageorg.hamcrest.core
PackageHierarchies:AllPackages
-
ClassHierarchy
java.lang.Objectorg.hamcrest.BaseMatcher(implementsorg.hamcrest.Matcher)
org.hamcrest.core.AllOforg.hamcrest.core.AnyOforg.hamcrest.core.DescribedAsorg.hamcrest.core.Isorg.hamcrest.core.IsAnythingorg.hamcrest.core.IsEqualorg.hamcrest.core.IsInstanceOforg.hamcrest.core.IsNotorg.hamcrest.core.IsNullorg.hamcrest.core.IsSame
NEXT
http://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
:REQUIRED|OPTIONAL :ELEMENT
-
org.junitAnnotationTypeAfter
@Retention(value=RUNTIME)@Target(value=METHOD)public@interfaceAfter
IfyouallocateexternalresourcesinaBeforemethodyouneedtoreleasethemafterthetestruns.Annotatingapublicvoidmethodwith@AftercausesthatmethodtoberunaftertheTestmethod.All@AftermethodsareguaranteedtorunevenifaBeforeorTestmethodthrowsanexception.The@Aftermethodsdeclaredinsuperclasseswillberunafterthoseofthecurrentclass.
Hereisasimpleexample:
publicclassExample{Fileoutput;@BeforepublicvoidcreateOutputFile(){output=newFile(...);}@Testpublicvoidsomething(){...}@AfterpublicvoiddeleteOutputFile(){output.delete();}}
:Before,Test
:REQUIRED|OPTIONAL :ELEMENT
http://java.sun.com/javase/6/docs/api/java/lang/annotation/Retention.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Retention.html#value()http://java.sun.com/javase/6/docs/api/java/lang/annotation/RetentionPolicy.html#RUNTIMEhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Target.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Target.html#value()http://java.sun.com/javase/6/docs/api/java/lang/annotation/ElementType.html#METHOD
-
:REQUIRED|OPTIONAL :ELEMENT
-
org.junitAnnotationTypeAfterClass
@Retention(value=RUNTIME)@Target(value=METHOD)public@interfaceAfterClass
IfyouallocateexpensiveexternalresourcesinaBeforeClassmethodyouneedtoreleasethemafterallthetestsintheclasshaverun.Annotatingapublicstaticvoidmethodwith@AfterClasscausesthatmethodtoberunafterallthetestsintheclasshavebeenrun.All@AfterClassmethodsareguaranteedtorunevenifaBeforeClassmethodthrowsanexception.The@AfterClassmethodsdeclaredinsuperclasseswillberunafterthoseofthecurrentclass.
Hereisasimpleexample:
publicclassExample{privatestaticDatabaseConnectiondatabase;@BeforeClasspublicstaticvoidlogin(){database=...;}@Testpublicvoidsomething(){...}@TestpublicvoidsomethingElse(){...}@AfterClasspublicstaticvoidlogout(){database.logout();}}
:BeforeClass,Test
:REQUIRED|OPTIONAL :ELEMENT
http://java.sun.com/javase/6/docs/api/java/lang/annotation/Retention.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Retention.html#value()http://java.sun.com/javase/6/docs/api/java/lang/annotation/RetentionPolicy.html#RUNTIMEhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Target.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/annotation/Target.html#value()http://java.sun.com/javase/6/docs/api/java/lang/annotation/ElementType.html#METHOD
-
:|| | :| |
-
org.junitClassAssertjava.lang.Object org.junit.Assert
publicclassAssert
extendsObject
Asetofassertionmethodsusefulforwritingtests.Onlyfailedassertionsarerecorded.Thesemethodscanbeuseddirectly:Assert.assertEquals(...),however,theyreadbetteriftheyarereferencedthroughstaticimport:
importstaticorg.junit.Assert.*;...assertEquals(...);
:AssertionError
protectedAssert()Protectconstructorsinceitisastaticonlyclass
staticvoidassertArrayEquals(byte[]expecteds,byte[]actuals)Assertsthattwobytearraysareequal.
staticvoidassertArrayEquals(char[]expecteds,char[]actuals)Assertsthattwochararraysareequal.
staticvoid
assertArrayEquals(double[]expecteds,double[]actuals,doubledelta)Assertsthattwodoublearraysareequal.
staticvoid
assertArrayEquals(float[]expecteds,float[]actuals,floatdelta)
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.html
-
Assertsthattwofloatarraysareequal.
staticvoidassertArrayEquals(int[]expecteds,int[]actuals)Assertsthattwointarraysareequal.
staticvoidassertArrayEquals(long[]expecteds,long[]actuals)Assertsthattwolongarraysareequal.
staticvoidassertArrayEquals(Object[]expecteds,Object[]actuals)Assertsthattwoobjectarraysareequal.
staticvoidassertArrayEquals(short[]expecteds,short[]actuals)Assertsthattwoshortarraysareequal.
staticvoid
assertArrayEquals(Stringmessage,byte[]expecteds,byte[]actuals)Assertsthattwobytearraysareequal.
staticvoid
assertArrayEquals(Stringmessage,char[]expecteds,char[]actuals)Assertsthattwochararraysareequal.
staticvoid
assertArrayEquals(Stringmessage,double[]expecteds,double[]actuals,doubledelta)Assertsthattwodoublearraysareequal.
staticvoid
assertArrayEquals(Stringmessage,float[]expecteds,float[]actuals,floatdelta)Assertsthattwofloatarraysareequal.
staticvoid
assertArrayEquals(Stringmessage,int[]expecteds,int[]actuals)Assertsthattwointarraysareequal.
staticvoid
assertArrayEquals(Stringmessage,long[]expecteds,long[]actuals)Assertsthattwolongarraysareequal.
staticvoid
assertArrayEquals(Stringmessage,Object[]expecteds,Object[]actuals)Assertsthattwoobjectarraysareequal.
staticvoid
assertArrayEquals(Stringmessage,short[]expecteds,short[]actuals)Assertsthattwoshortarraysareequal.
staticvoidassertEquals(doubleexpected,doubleactual)Deprecated.UseassertEquals(doubleexpected,doubleactual,doubleepsilon)insteadassertEquals(doubleexpected,doubleactual,
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.html
-
staticvoid doubledelta)Assertsthattwodoublesorfloatsareequaltowithinapositivedelta.
staticvoidassertEquals(longexpected,longactual)Assertsthattwolongsareequal.
staticvoidassertEquals(Object[]expecteds,Object[]actuals)Deprecated.useassertArrayEquals
staticvoidassertEquals(Objectexpected,Objectactual)Assertsthattwoobjectsareequal.
staticvoid
assertEquals(Stringmessage,doubleexpected,doubleactual)Deprecated.UseassertEquals(Stringmessage,doubleexpected,doubleactual,doubleepsilon)instead
staticvoid
assertEquals(Stringmessage,doubleexpected,doubleactual,doubledelta)Assertsthattwodoublesorfloatsareequaltowithinapositivedelta.
staticvoidassertEquals(Stringmessage,longexpected,longactual)Assertsthattwolongsareequal.
staticvoid
assertEquals(Stringmessage,Object[]expecteds,Object[]actuals)Deprecated.useassertArrayEquals
staticvoid
assertEquals(Stringmessage,Objectexpected,Objectactual)Assertsthattwoobjectsareequal.
staticvoidassertFalse(booleancondition)Assertsthataconditionisfalse.
staticvoidassertFalse(Stringmessage,booleancondition)Assertsthataconditionisfalse.
staticvoidassertNotNull(Objectobject)Assertsthatanobjectisn'tnull.
staticvoidassertNotNull(Stringmessage,Objectobject)Assertsthatanobjectisn'tnull.
staticvoidassertNotSame(Objectunexpected,Objectactual)Assertsthattwoobjectsdonotrefertothesameobject.assertNotSame(Stringmessage,Objectunexpected,
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
staticvoid Objectactual)Assertsthattwoobjectsdonotrefertothesameobject.
staticvoidassertNull(Objectobject)Assertsthatanobjectisnull.
staticvoidassertNull(Stringmessage,Objectobject)Assertsthatanobjectisnull.
staticvoidassertSame(Objectexpected,Objectactual)Assertsthattwoobjectsrefertothesameobject.
staticvoid
assertSame(Stringmessage,Objectexpected,Objectactual)Assertsthattwoobjectsrefertothesameobject.
static
void
assertThat(Stringreason,Tactual,org.hamcrest.Matchermatcher)Assertsthatactualsatisfiestheconditionspecifiedbymatcher.
static
void
assertThat(Tactual,org.hamcrest.Matchermatcher)Assertsthatactualsatisfiestheconditionspecifiedbymatcher.staticvoidassertTrue(booleancondition)Assertsthataconditionistrue.staticvoidassertTrue(Stringmessage,booleancondition)Assertsthataconditionistrue.staticvoidfail()Failsatestwithnomessage.staticvoidfail(Stringmessage)Failsatestwiththegivenmessage.java.lang. Objectclone,equals,finalize,getClass,hashCode,notify,notifyAll,toString,wait,wait,wait
Assert
protectedAssert()
http://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#finalize()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#getClass()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#hashCode()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notifyAll()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#toString()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait()http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long)http://java.sun.com/javase/6/docs/api/java/lang/Object.html#wait(long, int)
-
Protectconstructorsinceitisastaticonlyclass
assertTrue
publicstaticvoidassertTrue(Stringmessage,booleancondition)
Assertsthataconditionistrue.Ifitisn'titthrowsanAssertionErrorwiththegivenmessage.
:message-theidentifyingmessagefortheAssertionError(nullokay)condition-conditiontobechecked
assertTrue
publicstaticvoidassertTrue(booleancondition)
Assertsthataconditionistrue.Ifitisn'titthrowsanAssertionErrorwithoutamessage.
:condition-conditiontobechecked
assertFalse
publicstaticvoidassertFalse(Stringmessage,booleancondition)
Assertsthataconditionisfalse.Ifitisn'titthrowsanAssertionErrorwiththegivenmessage.
:message-theidentifyingmessagefortheAssertionError(null
http://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.html
-
okay)condition-conditiontobechecked
assertFalse
publicstaticvoidassertFalse(booleancondition)
Assertsthataconditionisfalse.Ifitisn'titthrowsanAssertionErrorwithoutamessage.
:condition-conditiontobechecked
fail
publicstaticvoidfail(Stringmessage)
Failsatestwiththegivenmessage.
:message-theidentifyingmessagefortheAssertionError(nullokay)
:AssertionError
fail
publicstaticvoidfail()
Failsatestwithnomessage.
assertEquals
publicstaticvoidassertEquals(Stringmessage,Objectexpected,Objectactual)
http://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.html
-
Assertsthattwoobjectsareequal.Iftheyarenot,anAssertionErroristhrownwiththegivenmessage.Ifexpectedandactualarenull,theyareconsideredequal.
:message-theidentifyingmessagefortheAssertionError(nullokay)expected-expectedvalueactual-actualvalue
assertEquals
publicstaticvoidassertEquals(Objectexpected,Objectactual)
Assertsthattwoobjectsareequal.Iftheyarenot,anAssertionErrorwithoutamessageisthrown.Ifexpectedandactualarenull,theyareconsideredequal.
:expected-expectedvalueactual-thevaluetocheckagainstexpected
assertArrayEquals
publicstaticvoidassertArrayEquals(Stringmessage,Object[]expecteds,Object[]actuals)throwsorg.junit.internal.ArrayComparisonFailure
Assertsthattwoobjectarraysareequal.Iftheyarenot,anAssertionErroristhrownwiththegivenmessage.Ifexpectedsandactualsarenull,theyareconsideredequal.
:message-theidentifyingmessagefortheAssertionError(nullokay)expecteds-Objectarrayorarrayofarrays(multi-dimensionalarray)
http://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/String.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/Object.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.htmlhttp://java.sun.com/javase/6/docs/api/java/lang/AssertionError.html
-
withexpectedvalues.actuals-Objectarrayorarrayofarrays(multi-dimensionalarray)withactualvalues
:org.junit.internal.ArrayComparisonFailure
assertArrayEquals
publicstaticvoidassertArrayEquals(Object[]expecteds,Object[]actuals)
Assertsthattwoobjectarraysareequal.Iftheyarenot,anAssertionErroristhrown.Ifexpectedandactualarenull,theyareconsideredequal.
:expecteds-Objectarrayorarrayofarrays(multi-dimensionalarray)withexpectedvaluesactuals-Objectarrayorarrayofarrays(multi-dimensionalarray)withactualvalues
assertArrayEqu