Package org.kohsuke.github.junit
Class WireMockRule
- java.lang.Object
-
- org.kohsuke.github.junit.WireMockRule
-
- All Implemented Interfaces:
com.github.tomakehurst.wiremock.core.Admin,com.github.tomakehurst.wiremock.core.Container,com.github.tomakehurst.wiremock.junit.Stubbing,org.junit.rules.MethodRule,org.junit.rules.TestRule
public class WireMockRule extends Object implements org.junit.rules.MethodRule, org.junit.rules.TestRule, com.github.tomakehurst.wiremock.core.Container, com.github.tomakehurst.wiremock.junit.Stubbing, com.github.tomakehurst.wiremock.core.Admin
- Author:
- Liam Newman
-
-
Constructor Summary
Constructors Constructor Description WireMockRule()WireMockRule(int port)WireMockRule(int port, Integer httpsPort)WireMockRule(com.github.tomakehurst.wiremock.core.Options options)WireMockRule(com.github.tomakehurst.wiremock.core.Options options, boolean failOnUnmatchedRequests)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMockServiceRequestListener(com.github.tomakehurst.wiremock.http.RequestListener listener)voidaddStubMapping(com.github.tomakehurst.wiremock.stubbing.StubMapping stubMapping)protected voidafter()org.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description)org.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, Object target)StringbaseUrl()protected voidbefore()com.github.tomakehurst.wiremock.verification.VerificationResultcountRequestsMatching(com.github.tomakehurst.wiremock.matching.RequestPattern requestPattern)voideditStub(com.github.tomakehurst.wiremock.client.MappingBuilder mappingBuilder)voideditStubMapping(com.github.tomakehurst.wiremock.stubbing.StubMapping stubMapping)voidenableRecordMappings(com.github.tomakehurst.wiremock.common.FileSource mappingsFileSource, com.github.tomakehurst.wiremock.common.FileSource filesFileSource)List<com.github.tomakehurst.wiremock.verification.LoggedRequest>findAll(com.github.tomakehurst.wiremock.matching.RequestPatternBuilder requestPatternBuilder)List<com.github.tomakehurst.wiremock.verification.NearMiss>findAllNearMissesFor(com.github.tomakehurst.wiremock.matching.RequestPatternBuilder requestPatternBuilder)com.github.tomakehurst.wiremock.admin.model.ListStubMappingsResultfindAllStubsByMetadata(com.github.tomakehurst.wiremock.matching.StringValuePattern pattern)List<com.github.tomakehurst.wiremock.verification.LoggedRequest>findAllUnmatchedRequests()List<com.github.tomakehurst.wiremock.verification.NearMiss>findNearMissesFor(com.github.tomakehurst.wiremock.verification.LoggedRequest loggedRequest)List<com.github.tomakehurst.wiremock.verification.NearMiss>findNearMissesForAllUnmatchedRequests()com.github.tomakehurst.wiremock.verification.FindNearMissesResultfindNearMissesForUnmatchedRequests()com.github.tomakehurst.wiremock.verification.FindRequestsResultfindRequestsMatching(com.github.tomakehurst.wiremock.matching.RequestPattern requestPattern)List<com.github.tomakehurst.wiremock.stubbing.StubMapping>findStubMappingsByMetadata(com.github.tomakehurst.wiremock.matching.StringValuePattern pattern)com.github.tomakehurst.wiremock.verification.FindNearMissesResultfindTopNearMissesFor(com.github.tomakehurst.wiremock.matching.RequestPattern requestPattern)com.github.tomakehurst.wiremock.verification.FindNearMissesResultfindTopNearMissesFor(com.github.tomakehurst.wiremock.verification.LoggedRequest loggedRequest)com.github.tomakehurst.wiremock.verification.FindRequestsResultfindUnmatchedRequests()com.github.tomakehurst.wiremock.admin.model.GetScenariosResultgetAllScenarios()List<com.github.tomakehurst.wiremock.stubbing.ServeEvent>getAllServeEvents()com.github.tomakehurst.wiremock.admin.model.GetGlobalSettingsResultgetGlobalSettings()com.github.tomakehurst.wiremock.global.GlobalSettingsHoldergetGlobalSettingsHolder()StringgetMethodName()com.github.tomakehurst.wiremock.core.OptionsgetOptions()com.github.tomakehurst.wiremock.recording.RecordingStatusResultgetRecordingStatus()com.github.tomakehurst.wiremock.admin.model.SingleServedStubResultgetServedStub(UUID id)com.github.tomakehurst.wiremock.admin.model.GetServeEventsResultgetServeEvents()com.github.tomakehurst.wiremock.stubbing.StubMappinggetSingleStubMapping(UUID id)com.github.tomakehurst.wiremock.admin.model.SingleStubMappingResultgetStubMapping(UUID id)List<com.github.tomakehurst.wiremock.stubbing.StubMapping>getStubMappings()com.github.tomakehurst.wiremock.stubbing.StubMappinggivenThat(com.github.tomakehurst.wiremock.client.MappingBuilder mappingBuilder)inthttpsPort()voidimportStubs(com.github.tomakehurst.wiremock.stubbing.StubImport stubImport)booleanisRunning()com.github.tomakehurst.wiremock.admin.model.ListStubMappingsResultlistAllStubMappings()voidloadMappingsUsing(com.github.tomakehurst.wiremock.standalone.MappingsLoader mappingsLoader)intport()voidremoveServeEvent(UUID uuid)com.github.tomakehurst.wiremock.verification.FindServeEventsResultremoveServeEventsForStubsMatchingMetadata(com.github.tomakehurst.wiremock.matching.StringValuePattern stringValuePattern)com.github.tomakehurst.wiremock.verification.FindServeEventsResultremoveServeEventsMatching(com.github.tomakehurst.wiremock.matching.RequestPattern requestPattern)voidremoveStub(com.github.tomakehurst.wiremock.client.MappingBuilder mappingBuilder)voidremoveStub(com.github.tomakehurst.wiremock.stubbing.StubMapping stubMapping)voidremoveStubMapping(com.github.tomakehurst.wiremock.stubbing.StubMapping stubMapping)voidremoveStubMappingsByMetadata(com.github.tomakehurst.wiremock.matching.StringValuePattern pattern)voidremoveStubsByMetadata(com.github.tomakehurst.wiremock.matching.StringValuePattern pattern)voidresetAll()voidresetMappings()voidresetRequests()voidresetScenarios()voidresetToDefaultMappings()voidsaveMappings()voidsetGlobalFixedDelay(int milliseconds)voidshutdown()voidshutdownServer()com.github.tomakehurst.wiremock.recording.SnapshotRecordResultsnapshotRecord()com.github.tomakehurst.wiremock.recording.SnapshotRecordResultsnapshotRecord(com.github.tomakehurst.wiremock.recording.RecordSpec spec)com.github.tomakehurst.wiremock.recording.SnapshotRecordResultsnapshotRecord(com.github.tomakehurst.wiremock.recording.RecordSpecBuilder spec)voidstart()voidstartRecording(com.github.tomakehurst.wiremock.recording.RecordSpec spec)voidstartRecording(com.github.tomakehurst.wiremock.recording.RecordSpecBuilder recordSpec)voidstartRecording(String targetBaseUrl)voidstop()com.github.tomakehurst.wiremock.recording.SnapshotRecordResultstopRecording()com.github.tomakehurst.wiremock.stubbing.StubMappingstubFor(com.github.tomakehurst.wiremock.client.MappingBuilder mappingBuilder)voidupdateGlobalSettings(com.github.tomakehurst.wiremock.global.GlobalSettings newSettings)Stringurl(String path)voidverify(int count, com.github.tomakehurst.wiremock.matching.RequestPatternBuilder requestPatternBuilder)voidverify(com.github.tomakehurst.wiremock.client.CountMatchingStrategy countMatchingStrategy, com.github.tomakehurst.wiremock.matching.RequestPatternBuilder requestPatternBuilder)voidverify(com.github.tomakehurst.wiremock.matching.RequestPatternBuilder requestPatternBuilder)
-
-
-
Constructor Detail
-
WireMockRule
public WireMockRule(com.github.tomakehurst.wiremock.core.Options options)
-
WireMockRule
public WireMockRule(com.github.tomakehurst.wiremock.core.Options options, boolean failOnUnmatchedRequests)
-
WireMockRule
public WireMockRule(int port)
-
WireMockRule
public WireMockRule(int port, Integer httpsPort)
-
WireMockRule
public WireMockRule()
-
-
Method Detail
-
getMethodName
public String getMethodName()
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)- Specified by:
applyin interfaceorg.junit.rules.TestRule
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, Object target)- Specified by:
applyin interfaceorg.junit.rules.MethodRule
-
before
protected void before()
-
after
protected void after()
-
loadMappingsUsing
public void loadMappingsUsing(com.github.tomakehurst.wiremock.standalone.MappingsLoader mappingsLoader)
-
getGlobalSettingsHolder
public com.github.tomakehurst.wiremock.global.GlobalSettingsHolder getGlobalSettingsHolder()
-
addMockServiceRequestListener
public void addMockServiceRequestListener(com.github.tomakehurst.wiremock.http.RequestListener listener)
-
enableRecordMappings
public void enableRecordMappings(com.github.tomakehurst.wiremock.common.FileSource mappingsFileSource, com.github.tomakehurst.wiremock.common.FileSource filesFileSource)
-
stop
public void stop()
-
start
public void start()
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfacecom.github.tomakehurst.wiremock.core.Container
-
port
public int port()
- Specified by:
portin interfacecom.github.tomakehurst.wiremock.core.Container
-
httpsPort
public int httpsPort()
-
baseUrl
public String baseUrl()
-
isRunning
public boolean isRunning()
-
givenThat
public com.github.tomakehurst.wiremock.stubbing.StubMapping givenThat(com.github.tomakehurst.wiremock.client.MappingBuilder mappingBuilder)
- Specified by:
givenThatin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
stubFor
public com.github.tomakehurst.wiremock.stubbing.StubMapping stubFor(com.github.tomakehurst.wiremock.client.MappingBuilder mappingBuilder)
- Specified by:
stubForin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
editStub
public void editStub(com.github.tomakehurst.wiremock.client.MappingBuilder mappingBuilder)
- Specified by:
editStubin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
removeStub
public void removeStub(com.github.tomakehurst.wiremock.client.MappingBuilder mappingBuilder)
- Specified by:
removeStubin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
removeStub
public void removeStub(com.github.tomakehurst.wiremock.stubbing.StubMapping stubMapping)
- Specified by:
removeStubin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
getStubMappings
public List<com.github.tomakehurst.wiremock.stubbing.StubMapping> getStubMappings()
- Specified by:
getStubMappingsin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
getSingleStubMapping
public com.github.tomakehurst.wiremock.stubbing.StubMapping getSingleStubMapping(UUID id)
- Specified by:
getSingleStubMappingin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
findStubMappingsByMetadata
public List<com.github.tomakehurst.wiremock.stubbing.StubMapping> findStubMappingsByMetadata(com.github.tomakehurst.wiremock.matching.StringValuePattern pattern)
- Specified by:
findStubMappingsByMetadatain interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
removeStubMappingsByMetadata
public void removeStubMappingsByMetadata(com.github.tomakehurst.wiremock.matching.StringValuePattern pattern)
- Specified by:
removeStubMappingsByMetadatain interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
removeStubMapping
public void removeStubMapping(com.github.tomakehurst.wiremock.stubbing.StubMapping stubMapping)
- Specified by:
removeStubMappingin interfacecom.github.tomakehurst.wiremock.core.Admin
-
verify
public void verify(com.github.tomakehurst.wiremock.matching.RequestPatternBuilder requestPatternBuilder)
- Specified by:
verifyin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
verify
public void verify(int count, com.github.tomakehurst.wiremock.matching.RequestPatternBuilder requestPatternBuilder)- Specified by:
verifyin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
verify
public void verify(com.github.tomakehurst.wiremock.client.CountMatchingStrategy countMatchingStrategy, com.github.tomakehurst.wiremock.matching.RequestPatternBuilder requestPatternBuilder)- Specified by:
verifyin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
findAll
public List<com.github.tomakehurst.wiremock.verification.LoggedRequest> findAll(com.github.tomakehurst.wiremock.matching.RequestPatternBuilder requestPatternBuilder)
- Specified by:
findAllin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
getAllServeEvents
public List<com.github.tomakehurst.wiremock.stubbing.ServeEvent> getAllServeEvents()
- Specified by:
getAllServeEventsin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
setGlobalFixedDelay
public void setGlobalFixedDelay(int milliseconds)
- Specified by:
setGlobalFixedDelayin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
findAllUnmatchedRequests
public List<com.github.tomakehurst.wiremock.verification.LoggedRequest> findAllUnmatchedRequests()
- Specified by:
findAllUnmatchedRequestsin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
findNearMissesForAllUnmatchedRequests
public List<com.github.tomakehurst.wiremock.verification.NearMiss> findNearMissesForAllUnmatchedRequests()
- Specified by:
findNearMissesForAllUnmatchedRequestsin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
findAllNearMissesFor
public List<com.github.tomakehurst.wiremock.verification.NearMiss> findAllNearMissesFor(com.github.tomakehurst.wiremock.matching.RequestPatternBuilder requestPatternBuilder)
- Specified by:
findAllNearMissesForin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
findNearMissesFor
public List<com.github.tomakehurst.wiremock.verification.NearMiss> findNearMissesFor(com.github.tomakehurst.wiremock.verification.LoggedRequest loggedRequest)
- Specified by:
findNearMissesForin interfacecom.github.tomakehurst.wiremock.junit.Stubbing
-
addStubMapping
public void addStubMapping(com.github.tomakehurst.wiremock.stubbing.StubMapping stubMapping)
- Specified by:
addStubMappingin interfacecom.github.tomakehurst.wiremock.core.Admin
-
editStubMapping
public void editStubMapping(com.github.tomakehurst.wiremock.stubbing.StubMapping stubMapping)
- Specified by:
editStubMappingin interfacecom.github.tomakehurst.wiremock.core.Admin
-
listAllStubMappings
public com.github.tomakehurst.wiremock.admin.model.ListStubMappingsResult listAllStubMappings()
- Specified by:
listAllStubMappingsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
getStubMapping
public com.github.tomakehurst.wiremock.admin.model.SingleStubMappingResult getStubMapping(UUID id)
- Specified by:
getStubMappingin interfacecom.github.tomakehurst.wiremock.core.Admin
-
saveMappings
public void saveMappings()
- Specified by:
saveMappingsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
resetAll
public void resetAll()
- Specified by:
resetAllin interfacecom.github.tomakehurst.wiremock.core.Admin
-
resetRequests
public void resetRequests()
- Specified by:
resetRequestsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
resetToDefaultMappings
public void resetToDefaultMappings()
- Specified by:
resetToDefaultMappingsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
getServeEvents
public com.github.tomakehurst.wiremock.admin.model.GetServeEventsResult getServeEvents()
- Specified by:
getServeEventsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
getServedStub
public com.github.tomakehurst.wiremock.admin.model.SingleServedStubResult getServedStub(UUID id)
- Specified by:
getServedStubin interfacecom.github.tomakehurst.wiremock.core.Admin
-
resetScenarios
public void resetScenarios()
- Specified by:
resetScenariosin interfacecom.github.tomakehurst.wiremock.core.Admin
-
resetMappings
public void resetMappings()
- Specified by:
resetMappingsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
countRequestsMatching
public com.github.tomakehurst.wiremock.verification.VerificationResult countRequestsMatching(com.github.tomakehurst.wiremock.matching.RequestPattern requestPattern)
- Specified by:
countRequestsMatchingin interfacecom.github.tomakehurst.wiremock.core.Admin
-
findRequestsMatching
public com.github.tomakehurst.wiremock.verification.FindRequestsResult findRequestsMatching(com.github.tomakehurst.wiremock.matching.RequestPattern requestPattern)
- Specified by:
findRequestsMatchingin interfacecom.github.tomakehurst.wiremock.core.Admin
-
findUnmatchedRequests
public com.github.tomakehurst.wiremock.verification.FindRequestsResult findUnmatchedRequests()
- Specified by:
findUnmatchedRequestsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
removeServeEvent
public void removeServeEvent(UUID uuid)
- Specified by:
removeServeEventin interfacecom.github.tomakehurst.wiremock.core.Admin
-
removeServeEventsMatching
public com.github.tomakehurst.wiremock.verification.FindServeEventsResult removeServeEventsMatching(com.github.tomakehurst.wiremock.matching.RequestPattern requestPattern)
- Specified by:
removeServeEventsMatchingin interfacecom.github.tomakehurst.wiremock.core.Admin
-
removeServeEventsForStubsMatchingMetadata
public com.github.tomakehurst.wiremock.verification.FindServeEventsResult removeServeEventsForStubsMatchingMetadata(com.github.tomakehurst.wiremock.matching.StringValuePattern stringValuePattern)
- Specified by:
removeServeEventsForStubsMatchingMetadatain interfacecom.github.tomakehurst.wiremock.core.Admin
-
updateGlobalSettings
public void updateGlobalSettings(com.github.tomakehurst.wiremock.global.GlobalSettings newSettings)
- Specified by:
updateGlobalSettingsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
findNearMissesForUnmatchedRequests
public com.github.tomakehurst.wiremock.verification.FindNearMissesResult findNearMissesForUnmatchedRequests()
- Specified by:
findNearMissesForUnmatchedRequestsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
getAllScenarios
public com.github.tomakehurst.wiremock.admin.model.GetScenariosResult getAllScenarios()
- Specified by:
getAllScenariosin interfacecom.github.tomakehurst.wiremock.core.Admin
-
findTopNearMissesFor
public com.github.tomakehurst.wiremock.verification.FindNearMissesResult findTopNearMissesFor(com.github.tomakehurst.wiremock.verification.LoggedRequest loggedRequest)
- Specified by:
findTopNearMissesForin interfacecom.github.tomakehurst.wiremock.core.Admin
-
findTopNearMissesFor
public com.github.tomakehurst.wiremock.verification.FindNearMissesResult findTopNearMissesFor(com.github.tomakehurst.wiremock.matching.RequestPattern requestPattern)
- Specified by:
findTopNearMissesForin interfacecom.github.tomakehurst.wiremock.core.Admin
-
startRecording
public void startRecording(String targetBaseUrl)
- Specified by:
startRecordingin interfacecom.github.tomakehurst.wiremock.core.Admin
-
startRecording
public void startRecording(com.github.tomakehurst.wiremock.recording.RecordSpec spec)
- Specified by:
startRecordingin interfacecom.github.tomakehurst.wiremock.core.Admin
-
startRecording
public void startRecording(com.github.tomakehurst.wiremock.recording.RecordSpecBuilder recordSpec)
- Specified by:
startRecordingin interfacecom.github.tomakehurst.wiremock.core.Admin
-
stopRecording
public com.github.tomakehurst.wiremock.recording.SnapshotRecordResult stopRecording()
- Specified by:
stopRecordingin interfacecom.github.tomakehurst.wiremock.core.Admin
-
getRecordingStatus
public com.github.tomakehurst.wiremock.recording.RecordingStatusResult getRecordingStatus()
- Specified by:
getRecordingStatusin interfacecom.github.tomakehurst.wiremock.core.Admin
-
snapshotRecord
public com.github.tomakehurst.wiremock.recording.SnapshotRecordResult snapshotRecord()
- Specified by:
snapshotRecordin interfacecom.github.tomakehurst.wiremock.core.Admin
-
snapshotRecord
public com.github.tomakehurst.wiremock.recording.SnapshotRecordResult snapshotRecord(com.github.tomakehurst.wiremock.recording.RecordSpecBuilder spec)
- Specified by:
snapshotRecordin interfacecom.github.tomakehurst.wiremock.core.Admin
-
snapshotRecord
public com.github.tomakehurst.wiremock.recording.SnapshotRecordResult snapshotRecord(com.github.tomakehurst.wiremock.recording.RecordSpec spec)
- Specified by:
snapshotRecordin interfacecom.github.tomakehurst.wiremock.core.Admin
-
getOptions
public com.github.tomakehurst.wiremock.core.Options getOptions()
- Specified by:
getOptionsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
shutdownServer
public void shutdownServer()
- Specified by:
shutdownServerin interfacecom.github.tomakehurst.wiremock.core.Admin
-
findAllStubsByMetadata
public com.github.tomakehurst.wiremock.admin.model.ListStubMappingsResult findAllStubsByMetadata(com.github.tomakehurst.wiremock.matching.StringValuePattern pattern)
- Specified by:
findAllStubsByMetadatain interfacecom.github.tomakehurst.wiremock.core.Admin
-
removeStubsByMetadata
public void removeStubsByMetadata(com.github.tomakehurst.wiremock.matching.StringValuePattern pattern)
- Specified by:
removeStubsByMetadatain interfacecom.github.tomakehurst.wiremock.core.Admin
-
importStubs
public void importStubs(com.github.tomakehurst.wiremock.stubbing.StubImport stubImport)
- Specified by:
importStubsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
getGlobalSettings
public com.github.tomakehurst.wiremock.admin.model.GetGlobalSettingsResult getGlobalSettings()
- Specified by:
getGlobalSettingsin interfacecom.github.tomakehurst.wiremock.core.Admin
-
-