Skip to content

Commit

Permalink
Updated product model tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rladdusaw committed Sep 11, 2020
1 parent 75b1051 commit c267f39
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/java/edu/tamu/app/model/ProductModelTest.java
Expand Up @@ -2,6 +2,8 @@

import static org.junit.Assert.assertEquals;

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

import org.junit.Test;
Expand Down Expand Up @@ -125,4 +127,26 @@ public void testRemoveRemoteProduct() {
assertEquals("Product did not correctly add the remote project!", false, remoteProjectInfo.contains(TEST_REMOTE_PROJECT_INFO1));
}

@Test
public void testSetOtherUrls() {
Product product = new Product(TEST_PRODUCT_NAME, TEST_PRODUCT_REMOTE_PROJECT_INFO_LIST1);
product.setOtherUrls(TEST_OTHER_URLS);
assertEquals("Product did not correctly set the other URLs", 2, product.getOtherUrls().size());
}

@Test
public void testAddOtherUrl() {
Product product = new Product(TEST_PRODUCT_NAME, TEST_PRODUCT_REMOTE_PROJECT_INFO_LIST1, TEST_PROJECT_SCOPE1, "", "", "", "", new ArrayList<String>(Arrays.asList(TEST_OTHER_URL_1)));
product.addOtherUrl(TEST_OTHER_URL_2);
assertEquals("Product did not correctly add the second URL", 2, product.getOtherUrls().size());
}

@Test
public void testRemoveOtherUrl() {
Product product = new Product(TEST_PRODUCT_NAME, TEST_PRODUCT_REMOTE_PROJECT_INFO_LIST1, TEST_PROJECT_SCOPE1, "", "", "", "", TEST_OTHER_URLS);
product.removeOtherUrl(TEST_OTHER_URL_1);
assertEquals("Product did not remove other URL", 1, product.getOtherUrls().size());
assertEquals("Product did not remove correct other URL", TEST_OTHER_URL_2, product.getOtherUrls().get(0));
}

}

0 comments on commit c267f39

Please sign in to comment.