Skip to content

Instantly share code, notes, and snippets.

@minisu
Created March 24, 2014 13:40
Show Gist options
  • Select an option

  • Save minisu/9740248 to your computer and use it in GitHub Desktop.

Select an option

Save minisu/9740248 to your computer and use it in GitHub Desktop.
@Before
public void setup() throws ComponentCreationException, IOException
{
ctu = new ComponentTestUtils();
ctu.getDefaultBeanInjectorMocker();
component = ctu.createComponentItem();
ComponentContext contextSpy = spy( component.getContext() );
ctu.mockStatisticsFor( component, contextSpy );
HtmlAssetScraper assetScraper = mock(HtmlAssetScraper.class);
Set<URI> assets = ImmutableSet.of(
URI.create( "http://www.example.org/image1.png" ),
URI.create( "http://www.example.org/style.css" )
);
when(assetScraper.scrapeUrl( anyString() )).thenReturn( assets );
httpClient = new FakeHttpClient();
runner = new WebRunner( contextSpy, assetScraper, FakeRequestRunnerProvider.usingHttpClient( httpClient ) );
ctu.setComponentBehavior( component, runner );
triggerTerminal = runner.getTriggerTerminal();
resultsTerminal = runner.getResultTerminal();
results = ctu.getMessagesFrom( resultsTerminal );
// GIVEN
setProperty( WEB_PAGE_URL_PROP, TEST_URL );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment