TankSimulation extends Tank { public Liquid takeOut(float amount) { Liquid current = this.getLiquid(); if (current.getAmount() < amount) { this.setLiquid(new Liquid(0, current.getTemperature(), current.getColor())); return current; } else { this.setLiquid(new Liquid(current.getAmount() - amount, current.getTemperature(), current.getColor())); return new Liquid(amount, current.getTemperature(), current.getColor()); } } TankSimulation(float capacity, TankSelector tankSelector, Liquid liquid, Pipe outPipe, Pipe inPipe); void putIn(Liquid input); Liquid takeOut(float amount);  }
@Test public void testTakeOut() { Liquid content = new Liquid(100, 350, new Color(0x421337)); TankSimulation tank = new TankSimulation(1000, TankSelector.valuesWithoutMix()[0], content, pipe1, pipe2); Liquid out = tank.takeOut(33); assertEquals(new Liquid(33, 350, new Color(0x421337)), out); out = tank.takeOut(500); assertEquals(new Liquid(67, 350, new Color(0x421337)), out); }