@SuppressWarnings("unchecked")
@Test
public void testToArray() {

    Enumeration<String> keys = createMock(Enumeration.class);
    Enumeration<String> values1 = createMock(Enumeration.class);
    Enumeration<String> values2 = createMock(Enumeration.class);
    expect(extractor.getKeys()).andReturn(keys);
    expect(keys.hasMoreElements()).andReturn(true);
    expect(keys.nextElement()).andReturn("one");
    expect(keys.hasMoreElements()).andReturn(true);
    expect(keys.nextElement()).andReturn("two");
    expect(keys.hasMoreElements()).andReturn(false);
    replay(extractor, keys, values1, values2);
    assertArrayEquals(new String[] {"one", "two"}, entrySet.toArray());
    verify(extractor, keys, values1, values2);
}