To do this, I would like to get the HTML output for just that specific component.
Instead of making your assertions on the HTML output, you could use TagTester to test the CSS classes like this:
WicketTester tester = new WicketTester(new WicketApplication());
tester.startPage(MyPage.class);
TagTester tagTester = tester.getTagByWicketId("myWicketComponent");
Assert.assertEquals("classA classB", tagTester.getAttribute("class"));
Try if this works for you.