### Question:
ObjectEntry extends ApiEntry { public Object call(String functionName, Object[] args) { FunctionEntry functionEntry = (FunctionEntry) classEntry.get(functionName); return functionEntry.call(proxiedObject, args); } private  ObjectEntry(); String getClassName(); Object call(String functionName, Object[] args); Object getProxiedObject();  }### Answer:
@Test void passesOnFunctionCallToTheCorrectFunctionEntry() { Object proxiedObject = new Object(); FunctionEntry functionEntry = mock(FunctionEntry.class); ClassEntry.Builder classEntryBuilder = new ClassEntry.Builder(); classEntryBuilder.add("function1", functionEntry); ClassEntry classEntry = classEntryBuilder.build(); ObjectEntry.Builder builder = new ObjectEntry.Builder(); builder.setClass("ignore", classEntry); builder.setProxiedObject(proxiedObject); ObjectEntry objectEntry = builder.build(); Object[] args = new Object[] {"one", 2, true}; objectEntry.call("function1", args); verify(functionEntry).call(proxiedObject, args); }
@Test void returnsValueReturnedByFunctionCall() { Object proxiedObject = new Object(); FunctionEntry functionEntry = mock(FunctionEntry.class); when(functionEntry.call(any(), any())).thenReturn("expected return value"); ClassEntry.Builder classEntryBuilder = new ClassEntry.Builder(); classEntryBuilder.add("function1", functionEntry); ClassEntry classEntry = classEntryBuilder.build(); ObjectEntry.Builder builder = new ObjectEntry.Builder(); builder.setClass("ignore", classEntry); builder.setProxiedObject(proxiedObject); ObjectEntry objectEntry = builder.build(); Object[] args = new Object[] {"one", 2, true}; Object returnValue = objectEntry.call("function1", args); assertThat(returnValue).isSameAs("expected return value"); }