### Question:
NewInstanceOp extends ExecutionContextOp { @Override public void execute(ExecutionNode node, ExecutionContext context) { Object instance = new UninitializedInstance(virtualClass); if (vm.isSafe(virtualClass)) { sideEffectLevel = SideEffect.Level.NONE; } else { context.readClassState(virtualClass); sideEffectLevel = context.getClassSideEffectLevel(virtualClass); } MethodState mState = context.getMethodState(); HeapItem instanceItem = new HeapItem(instance, virtualClass.getName()); mState.assignRegister(destRegister, instanceItem); } NewInstanceOp(MethodLocation location, MethodLocation child, int destRegister, VirtualClass virtualClass,
                  VirtualMachine vm); @Override void execute(ExecutionNode node, ExecutionContext context); @Override SideEffect.Level getSideEffectLevel(); @Override String toString();  }### Answer:
@Test public void canCreateLocalInstance() throws ClassNotFoundException { initial.setRegisters(0, 1, "I"); ExecutionGraph graph = VMTester.execute(vm, CLASS_NAME, "newLocalInstance()V", initial); VirtualType instanceType = vm.getClassManager().getVirtualType(CLASS_NAME); expected.setRegisters(0, new UninitializedInstance(instanceType), CLASS_NAME); VMTester.testState(graph, expected); }
@Test public void canCreateNonLocalInstance() { initial.setRegisters(0, 1, "I"); ExecutionGraph graph = VMTester.execute(vm, CLASS_NAME, "newNonLocalInstance()V", initial); VirtualType instanceType = vm.getClassManager().getVirtualType("Ljava/lang/Integer;"); expected.setRegisters(0, new UninitializedInstance(instanceType), "Ljava/lang/Integer;"); VMTester.testState(graph, expected); }