import java.util.Arrays;
import java.util.List;

import org.junit.*;
import static org.junit.Assert.*;

public class StoreTest {

  @Rule
  public DatabaseRule database = new DatabaseRule();


  @Test
  public void equals_returnsTrueIfSameName() {
    Store firstStore = new Store("Foot Locker");
    firstStore.save();
    Store secondStore = new Store("Foot Locker");
    secondStore.save();
    assertTrue(firstStore.equals(secondStore));
  }

  @Test
  public void all_emptyAtFirst() {
    assertEquals(Store.all().size(), 0);
  }

  @Test
  public void store_instantiatesNameAndFindsItInListOfStores() {
    Store store = new Store("Foot Locker");
    store.save();
    assertEquals("Foot Locker", Store.find(store.getId()).getName());
  }

  @Test
  public void store_deleteWorksProperly_0() {
    Store store = new Store("Foot Locker");
    store.save();
    store.delete();
    // TO DO: Add onto this test to test include storeConnection in stores_brands, after addStore & getAllStores methods are added to Brand class.
    assertEquals(0, Store.all().size());
  }

  @Test
  public void store_updateWorksProperly() {
    Store store = new Store("Foot Locker");
    store.save();
    store.update("Sprint");
    assertEquals(store.getName(), "Sprint");
  }

  @Test
  public void getAllBrands_ListsAllBrandsCarriedByStore() {
    Store store = new Store("Foot Locker");
    store.save();
    Brand firstBrand = new Brand("Nike");
    firstBrand.save();
    Brand secondBrand = new Brand("Adidas");
    secondBrand.save();
    Brand thirdBrand = new Brand("New Balance");
    thirdBrand.save();
    store.addBrand(firstBrand.getId());
    store.addBrand(secondBrand.getId());
    store.addBrand(thirdBrand.getId());
    Brand[] brands = new Brand[] {firstBrand, secondBrand, thirdBrand};
    assertTrue(store.getAllBrands().containsAll(Arrays.asList(brands)));
  }

}

@@ -777,23 +777,67 @@
 lete
-WorksProperly_0
+sAStoreAndInstanceOfStoreIdInStoresBrandsJoinTable_1_Sprint
 () %7B
@@ -907,170 +907,275 @@
     
-s
+S
 tore
-.delete();%0A    // TO DO: Add onto this test to test include storeConnection in stores_brands, after addStore & getAllStores methods are added to Brand class.
+ anotherStore = new Store(%22Sprint%22);%0A    anotherStore.save();%0A    Brand brand = new Brand(%22Nike%22);%0A    brand.save();%0A    brand.addStore(store.getId());%0A    brand.addStore(anotherStore.getId());%0A    store.delete();%0A    Store%5B%5D stores = new Store%5B%5D %7BanotherStore%7D;
 %0A   
@@ -1188,17 +1188,17 @@
 tEquals(
-0
+1
 , Store.
@@ -1208,24 +1208,97 @@
 ().size());%0A
+    assertTrue(brand.getAllStores().containsAll(Arrays.asList(stores)));%0A
   %7D%0A%0A  @Test

Improve delete testing for StoreTest to include testing for removal of store_id in stores_brands join table.