### Question:
Star { public void timePasses() { ageYears *= 2; massTons *= 8; switch (type) { case RED_GIANT: type = StarType.WHITE_DWARF; break; case SUN: type = StarType.RED_GIANT; break; case SUPERNOVA: type = StarType.DEAD; break; case WHITE_DWARF: type = StarType.SUPERNOVA; break; case DEAD: ageYears *= 2; massTons = 0; break; default: break; } } Star(StarType startType, int startAge, int startMass); void timePasses(); @Override String toString();  }### Answer:
@Test public void testTimePasses() { final var star = new Star(StarType.SUN, 1, 2); assertEquals("sun age: 1 years mass: 2 tons", star.toString()); star.timePasses(); assertEquals("red giant age: 2 years mass: 16 tons", star.toString()); star.timePasses(); assertEquals("white dwarf age: 4 years mass: 128 tons", star.toString()); star.timePasses(); assertEquals("supernova age: 8 years mass: 1024 tons", star.toString()); star.timePasses(); assertEquals("dead star age: 16 years mass: 8192 tons", star.toString()); star.timePasses(); assertEquals("dead star age: 64 years mass: 0 tons", star.toString()); star.timePasses(); assertEquals("dead star age: 256 years mass: 0 tons", star.toString()); }
@Test public void testTimePasses() { final Star star = new Star(StarType.SUN, 1, 2); assertEquals("sun age: 1 years mass: 2 tons", star.toString()); star.timePasses(); assertEquals("red giant age: 2 years mass: 16 tons", star.toString()); star.timePasses(); assertEquals("white dwarf age: 4 years mass: 128 tons", star.toString()); star.timePasses(); assertEquals("supernova age: 8 years mass: 1024 tons", star.toString()); star.timePasses(); assertEquals("dead star age: 16 years mass: 8192 tons", star.toString()); star.timePasses(); assertEquals("dead star age: 64 years mass: 0 tons", star.toString()); star.timePasses(); assertEquals("dead star age: 256 years mass: 0 tons", star.toString()); }