### Question:
Container { public Fault fault(String name, String params) { return fault(name, RandomStringUtils.randomAlphanumeric(8), params); } Container();  Container(Scheduler scheduler, Repository repository); Scheduler scheduler(); Repository repository(); Fault fault(String name, String params); Fault fault(String name, String id, String params); Map<String, Class<? extends Fault>> classes(); Map<String, Fault> faults(); Map<String, Interceptor> interceptors(); void shutdown();  }### Answer:
@Test public void testFaultStringString() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { Container container = new Container(); Map<String, Class<? extends Fault>> classes = new HashMap<>(); classes.put("fault-2", Fault2.class); Field classesField = Container.class.getDeclaredField("classes"); classesField.setAccessible(true); classesField.set(container, classes); Fault2 fault2 = (Fault2) container.fault("fault-2", "{\"property2\":2,\"property3\":\"hello\"}"); assertThat(fault2.id().length(), is(8)); }
@Test public void testFaultStringStringString() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { Container container = new Container(); Map<String, Class<? extends Fault>> classes = new HashMap<>(); classes.put("fault-2", Fault2.class); Field classesField = Container.class.getDeclaredField("classes"); classesField.setAccessible(true); classesField.set(container, classes); Fault fault = container.fault("fault-1", "fault-id-1", "{}"); assertNull(fault); fault = container.fault("fault-2", "fault-id-2", "{invalid : json}"); assertNull(fault); Fault2 fault2 = (Fault2) container.fault("fault-2", "fault-id-2", "{\"property2\":2,\"property3\":\"hello\"}"); assertThat(fault2.id(), is("fault-id-2")); assertNull(fault2.getProperty1()); assertThat(fault2.getProperty2(), is(2)); }