@Test
public void testProviderContext() throws Exception {

    try {
        context.getProvider(mockInterface);
        fail("Should throw IllegalArgumentException for get un-registered provider.");
    } catch (IllegalArgumentException ex) {
        // expected
    }
    try {
        context.registerProvider(mockInterface, null);
        fail("Should throw IllegalArgumentException for registering null.");
    } catch (IllegalArgumentException ex) {
        // expected
    }
    try {
        context.registerProvider(null, mockProvider);
        fail("Should throw IllegalArgumentException for registering null type.");
    } catch (IllegalArgumentException ex) {
        // expected
    }
    try {
        context.registerProvider(mockProvider.getClass(), mockProvider);
        fail("Should throw IllegalArgumentException for registering class type.");
    } catch (IllegalArgumentException ex) {
        // expected
    }
    try {
        context.registerProvider(IMockProvider2.class, mockProvider);
        fail("Should throw IllegalArgumentException for registering un-compatible provider.");
    } catch (IllegalArgumentException ex) {
        // expected
    }
    context.registerProvider(mockInterface, mockProvider);
    try {
        context.registerProvider(mockInterface, mockProvider);
        fail("Should throw IllegalArgumentException for duplicate registration.");
    } catch (IllegalArgumentException ex) {
        // expected
    }
    assertEquals("Should get the registered provider", context.getProvider(mockInterface), mockProvider);
    assertEquals("Should get the registered provider", context.getProvider(mockInterface), mockProvider);
}