T
- The type to be returned (normally the subclass' type)public abstract class LoadableComponent<T extends LoadableComponent<T>> extends Object
new HypotheticalComponent().get();
After the get()
method is called, the component will be loaded and
ready for use. This is verified using Assert.assertTrue so expect to catch an Error rather than
an Exception when errors occur. *
Constructor and Description |
---|
LoadableComponent() |
Modifier and Type | Method and Description |
---|---|
T |
get()
Ensure that the component is currently loaded.
|
protected abstract void |
isLoaded()
Determine whether or not the component is loaded.
|
protected abstract void |
load()
When this method returns, the component modeled by the subclass should be fully loaded.
|
public T get()
Error
- when the component cannot be loaded.protected abstract void load()
protected abstract void isLoaded() throws Error
This behaviour makes it readily visible when a page has not been loaded successfully, and because an error and not an exception is thrown tests should fail as expected. By using Error, we also allow the use of junit's "Assert.assert*" methods
Error
- when the page is not loaded.Copyright © 2013. All rights reserved.