コード例 #1
0
 /**
  * Test method for {@link
  * com.marcelherd.uebung2.auto.CarDealer#sell(com.marcelherd.uebung2.auto.Car)}.
  */
 @Test
 public void testSellNonExistant() {
   GasolineCar bmw = Cars.BMW;
   assertFalse(dealer.getCars().contains(bmw));
   assertEquals(0, dealer.getCars().size());
   dealer.sell(bmw);
   assertFalse(dealer.getCars().contains(bmw));
   assertEquals(0, dealer.getCars().size());
 }
コード例 #2
0
 /**
  * Test method for {@link
  * com.marcelherd.uebung2.auto.CarDealer#sell(com.marcelherd.uebung2.auto.Car)}.
  */
 @Test
 public void testSell() {
   GasolineCar bmw = Cars.BMW;
   assertTrue(dealer.getCars().isEmpty());
   assertEquals(0, dealer.getCars().size());
   assertFalse(dealer.getCars().contains(bmw));
   dealer.offer(bmw);
   assertTrue(dealer.getCars().contains(bmw));
   assertEquals(1, dealer.getCars().size());
   dealer.sell(bmw);
   assertFalse(dealer.getCars().contains(bmw));
   assertEquals(0, dealer.getCars().size());
 }