@Test(expected = IllegalStateException.class) public void testSetTitle() { Movie m = new Movie(); m.setTitle("Hallo"); assertEquals("Hallo", m.getTitle()); m.setTitle(null); }
public void setTitle(String aTitle) { if (this.title != null) { throw new IllegalStateException(); } this.title = aTitle; }
Movie { public void setTitle(String aTitle) { if (this.title != null) { throw new IllegalStateException(); } this.title = aTitle; } }
Movie { public void setTitle(String aTitle) { if (this.title != null) { throw new IllegalStateException(); } this.title = aTitle; } protected  Movie();  Movie(String aTitle, PriceCategory aPriceCategory);  Movie(String aTitle, Date aReleaseDate, PriceCategory aPriceCategory); }
Movie { public void setTitle(String aTitle) { if (this.title != null) { throw new IllegalStateException(); } this.title = aTitle; } protected  Movie();  Movie(String aTitle, PriceCategory aPriceCategory);  Movie(String aTitle, Date aReleaseDate, PriceCategory aPriceCategory); PriceCategory getPriceCategory(); void setPriceCategory(PriceCategory aPriceCategory); String getTitle(); void setTitle(String aTitle); Date getReleaseDate(); void setReleaseDate(Date aReleaseDate); boolean isRented(); void setRented(boolean isRented); int getId(); void setId(int anId); @Override int hashCode(); @Override boolean equals(Object obj); }
Movie { public void setTitle(String aTitle) { if (this.title != null) { throw new IllegalStateException(); } this.title = aTitle; } protected  Movie();  Movie(String aTitle, PriceCategory aPriceCategory);  Movie(String aTitle, Date aReleaseDate, PriceCategory aPriceCategory); PriceCategory getPriceCategory(); void setPriceCategory(PriceCategory aPriceCategory); String getTitle(); void setTitle(String aTitle); Date getReleaseDate(); void setReleaseDate(Date aReleaseDate); boolean isRented(); void setRented(boolean isRented); int getId(); void setId(int anId); @Override int hashCode(); @Override boolean equals(Object obj);  }