public void testGetResourceBar() { // init PowerMock.mockStatic(CSStringUtil.class); EasyMock.expect(CSStringUtil.isNotNil(testType)).andReturn(true); EasyMock.expect(CSStringUtil.removeTheTail(testType, ResourceBarCollection.VERSION)) .andReturn(testType); PowerMock.replayAll(); // invoke ResourceBar result = resourceBarCollection.getResourceBar(testType); PowerMock.verifyAll(); // assert assertEquals(resourceBar1, result); }
public void testGetResourceBar_null() { // init PowerMock.mockStatic(CSStringUtil.class); EasyMock.expect(CSStringUtil.isNotNil(testType)).andReturn(false).times(3); PowerMock.replayAll(); // invoke ResourceBar result = resourceBarCollection.getResourceBar(""); PowerMock.verifyAll(); // assert assertNull(result); }