### Question:
HeartbeatAwsEc2Contributor implements HeartbeatContributor { @Override public void contributeToHttpCall(HeartbeatCall call) { String awsEc2InstanceType; if (awsEc2MetadataClient.isEc2Instance()) { awsEc2InstanceType = awsEc2MetadataClient.getEc2InstanceMetadataItem(AwsEc2MetadataClient.INSTANCE_TYPE_RESOURCE); call.addParameter("ec2InstanceType", awsEc2InstanceType); } call.addParameter("ec2Instance", instanceProductTypeResolver.getAwsProductNameForHeartBeat()); }  @Override void contributeToHttpCall(HeartbeatCall call); void setAwsEc2MetadataClient(AwsEc2MetadataClient awsEc2MetadataClient); void setInstanceProductTypeResolver(InstanceProductTypeResolver instanceProductTypeResolver);  }### Answer:
@Test void contributeToHttpCall_notEc2Instance_ec2InstanceParamIsContributed() { doReturn(false).when(awsEc2MetadataClient).isEc2Instance(); objectUnderTest.contributeToHttpCall(heartbeatCall); verify(heartbeatCall).addParameter(EC_2_INSTANCE_KEY, AWS_PRODUCT_NAME_FOR_HEART_BEAT); }
@Test void contributeToHttpCall_ec2Instance_ec2InstanceTypeAndEc2InstanceParamsAreContributed() { doReturn(true).when(awsEc2MetadataClient).isEc2Instance(); objectUnderTest.contributeToHttpCall(heartbeatCall); verify(heartbeatCall).addParameter(EC_2_INSTANCE_KEY, AWS_PRODUCT_NAME_FOR_HEART_BEAT); verify(heartbeatCall).addParameter(EC_2_INSTANCE_TYPE_KEY, AWS_EC_2_INSTANCE_TYPE); }