AmazonItem { public AmazonItem updateItem(Float newPrice) { this.previousPrice = this.currentPrice; this.currentPrice = newPrice; return this; } AmazonItem(String title, Float currentPrice, String url);  AmazonItem(String title, Float currentPrice, Float previousPrice, String url); AmazonItem updateItem(Float newPrice); public String title; public Float currentPrice; public Float previousPrice; public String url; }
@Test public void updateItemTest() { AmazonItem item = new AmazonItem( "Item example title", 100.0f, "https: AmazonItem updatedItem = item.updateItem(50.0f); assertEquals(50.0f, updatedItem.currentPrice, 0); }