RealObjectMapping { <T> void put(DependencyKey<T> key, TypeToken<? extends T> implementationToken, boolean shouldMapDependency) { if (mMap.containsKey(key)) { throw new RepeatedDependencyDefinedException(key); } mMap.put(key, new Implementation(implementationToken, shouldMapDependency)); }    }
@Test(expected = RepeatedDependencyDefinedException.class) public void testCantOverwrite() { mRealObjectMapping.put(testInterfaceDependencyKey, testClassTypeToken, true); mRealObjectMapping.put(testInterfaceDependencyKey, testClass2TypeToken, true); }