@Test public void testGetInstanceFieldUnexisting() { Symbol instance = EasyMock.createMock(Symbol.class); EasyMock.replay(instance); int exceptions = 0; try { invokableA.getInstanceField("foo", instance); } catch (IllegalArgumentException uoe) { exceptions++; } try { invokableB.getInstanceField("foo", instance); } catch (IllegalArgumentException uoe) { exceptions++; } try { invokableC.getInstanceField("foo", instance); } catch (IllegalArgumentException uoe) { exceptions++; } try { invokableD.getInstanceField("foo", instance); } catch (IllegalArgumentException uoe) { exceptions++; } assertEquals(4, exceptions); EasyMock.verify(instance); }
@Override public Symbol getInstanceField(String fieldName, Symbol instance) { throw new IllegalArgumentException(describe() + " has no field named " + fieldName); }
InvokableReferenceTypeUsage implements TypeUsage, Invokable { @Override public Symbol getInstanceField(String fieldName, Symbol instance) { throw new IllegalArgumentException(describe() + " has no field named " + fieldName); } }
InvokableReferenceTypeUsage implements TypeUsage, Invokable { @Override public Symbol getInstanceField(String fieldName, Symbol instance) { throw new IllegalArgumentException(describe() + " has no field named " + fieldName); } InvokableReferenceTypeUsage(InternalInvokableDefinition internalInvokableDefinition); }
InvokableReferenceTypeUsage implements TypeUsage, Invokable { @Override public Symbol getInstanceField(String fieldName, Symbol instance) { throw new IllegalArgumentException(describe() + " has no field named " + fieldName); } InvokableReferenceTypeUsage(InternalInvokableDefinition internalInvokableDefinition); @Override TypeUsage replaceTypeVariables(Map<String, T> typeParams); @Override boolean sameType(TypeUsage other); @Override boolean isInvokable(); @Override Invokable asInvokable(); @Override JvmType jvmType(); @Override boolean hasInstanceField(String fieldName, Symbol instance); @Override Symbol getInstanceField(String fieldName, Symbol instance); @Override Optional<Invokable> getMethod(String method, boolean staticContext); @Override boolean canBeAssignedTo(TypeUsage type); @Override boolean isOverloaded(); @Override Optional<InternalInvokableDefinition> internalInvokableDefinitionFor(List<ActualParam> actualParams); @Override String describe(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
InvokableReferenceTypeUsage implements TypeUsage, Invokable { @Override public Symbol getInstanceField(String fieldName, Symbol instance) { throw new IllegalArgumentException(describe() + " has no field named " + fieldName); } InvokableReferenceTypeUsage(InternalInvokableDefinition internalInvokableDefinition); @Override TypeUsage replaceTypeVariables(Map<String, T> typeParams); @Override boolean sameType(TypeUsage other); @Override boolean isInvokable(); @Override Invokable asInvokable(); @Override JvmType jvmType(); @Override boolean hasInstanceField(String fieldName, Symbol instance); @Override Symbol getInstanceField(String fieldName, Symbol instance); @Override Optional<Invokable> getMethod(String method, boolean staticContext); @Override boolean canBeAssignedTo(TypeUsage type); @Override boolean isOverloaded(); @Override Optional<InternalInvokableDefinition> internalInvokableDefinitionFor(List<ActualParam> actualParams); @Override String describe(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }