@Test public void addLinkTest() { Agreement agreement = new Agreement(); assertEquals(null, agreement.getLinks()); Link link = new Link(); agreement.addLink(link); assertEquals(1, agreement.getLinks().size()); assertEquals(link, agreement.getLinks().get(0)); }
public void addLink(Link link) { if(links==null) links = new ArrayList<Link>(); links.add(link); }
Agreement { public void addLink(Link link) { if(links==null) links = new ArrayList<Link>(); links.add(link); } }
Agreement { public void addLink(Link link) { if(links==null) links = new ArrayList<Link>(); links.add(link); }  }
Agreement { public void addLink(Link link) { if(links==null) links = new ArrayList<Link>(); links.add(link); }  @Transient String getHref(); void setHref(String href); @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name = "agreement_id", unique = true, nullable = false) int getId(); void setId(int id); @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="deployment_id") Deployment getDeployment(); void setDeployment(Deployment deployment); @Column(name = "price", nullable = true) String getPrice(); void setPrice(String price); @Column(name = "sla_agreement", length=900000) String getSlaAgreement(); void setSlaAgreement(String slaAgreement); @Column(name = "provider_id", nullable = true) String getProviderId(); void setProviderId(String providerId); @Column(name = "sla_agreement_id", nullable = true) String getSlaAgreementId(); void setSlaAgreementId(String slaAgreementId); @Column(name = "negotiation_id", nullable = true) String getNegotiationId(); void setNegotiationId(String negotiationId); @Column(name = "accepted", nullable = true) boolean isAccepted(); void setAccepted(boolean accepted); @Transient List<Link> getLinks(); void setLinks(List<Link> links); void addLink(Link link); @Column(name = "order_in_array", nullable = true) int getOrderInArray(); void setOrderInArray(int orderInArray); @Column(name = "valid_until", nullable = true) Timestamp getValidUntil(); void setValidUntil(Timestamp validUntil); }
Agreement { public void addLink(Link link) { if(links==null) links = new ArrayList<Link>(); links.add(link); }  @Transient String getHref(); void setHref(String href); @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name = "agreement_id", unique = true, nullable = false) int getId(); void setId(int id); @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="deployment_id") Deployment getDeployment(); void setDeployment(Deployment deployment); @Column(name = "price", nullable = true) String getPrice(); void setPrice(String price); @Column(name = "sla_agreement", length=900000) String getSlaAgreement(); void setSlaAgreement(String slaAgreement); @Column(name = "provider_id", nullable = true) String getProviderId(); void setProviderId(String providerId); @Column(name = "sla_agreement_id", nullable = true) String getSlaAgreementId(); void setSlaAgreementId(String slaAgreementId); @Column(name = "negotiation_id", nullable = true) String getNegotiationId(); void setNegotiationId(String negotiationId); @Column(name = "accepted", nullable = true) boolean isAccepted(); void setAccepted(boolean accepted); @Transient List<Link> getLinks(); void setLinks(List<Link> links); void addLink(Link link); @Column(name = "order_in_array", nullable = true) int getOrderInArray(); void setOrderInArray(int orderInArray); @Column(name = "valid_until", nullable = true) Timestamp getValidUntil(); void setValidUntil(Timestamp validUntil);  }