Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paper updates for resubmit #50

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
507 changes: 507 additions & 0 deletions data/2_6_locs_bugs.data

Large diffs are not rendered by default.

1,019 changes: 1,019 additions & 0 deletions data/all_single_module.txt

Large diffs are not rendered by default.

945 changes: 945 additions & 0 deletions data/bugswithspectra.txt

Large diffs are not rendered by default.

221 changes: 221 additions & 0 deletions data/diffs/2018swecapstone-h2ms-356638992-356666847
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
Only in after/: bears.json
Only in after/: classpath.info
diff -r -x '*.log' -x '*.config' -x '*git*' -x '*.md' -x '*.xml' before/src/main/java/edu/harvard/h2ms/service/utils/H2msRestUtils.java after/src/main/java/edu/harvard/h2ms/service/utils/H2msRestUtils.java
22c22,23
< * @return
---
> * @return - when events are emptys a null string list is returned
> * - when timeframe is not a valid value a null string list is returned
51a53,61
> // Null cases
> if (month == null || year == null)
> return null;
>
> // Invalid value cases
> if(month < 0 || month > 11 || year < 1)
> return null;
>
> // Format Month
74c84
< } else if(month.equals(11)){
---
> } else if (month.equals(11)){
77c87
< return "";
---
> return null;
84c94,102
< // Special cases (ie. 11, 12, 13 are postfixed with 'th')
---
> // Null cases
> if(week == null || year == null)
> return null;
>
> // Invalid value cases
> if(week < 1 || week > 52 || year < 1)
> return null;
>
> // Format Week for special cases (ie. 11, 12, 13 are postfixed with 'th')
87a106
> // Format Week
105a125,134
>
> // Null cases
> if(month == null || year == null)
> return null;
>
> // Invalid value cases
> if(month < 0 || month > 11 || year < 1)
> return null;
>
> // Format month
diff -r -x '*.log' -x '*.config' -x '*git*' -x '*.md' -x '*.xml' before/src/test/java/edu/harvard/h2ms/web/init/H2msRestUtilsTest.java after/src/test/java/edu/harvard/h2ms/web/init/H2msRestUtilsTest.java
6a7
> import org.assertj.core.api.Assertions;
9d9
< import org.springframework.test.context.junit4.SpringRunner;
11a12,13
> import javax.swing.text.html.Option;
> import java.util.*;
12a15,17
> /**
> * Unit Tests for H2MS Rest Utility Class
> */
15a21,23
> /**
> * Tests Week Formatting from Utils with valid values
> */
18c26
< public void format_week_success(Integer week, Integer year, String result){
---
> public void test_format_week_success(Integer week, Integer year, String result){
27,36c35,53
< {2, 2018, "2nd (2018)"},
< {11, 2018, "11th (2018)"},
< {12, 2018, "12th (2018)"},
< {13, 2018, "13th (2018)"},
< {21, 2018, "21st (2018)"},
< {22, 2018, "22nd (2018)"},
< {23, 2018, "23rd (2018)"},
< {44, 3023, "44th (3023)"},
< {36, 1000, "36th (1000)"},
< {41, 318, "41st (318)"}
---
> // All valid values of weeks
> {1, 2018, "1st (2018)"}, {2, 2018, "2nd (2018)"},
> {3, 2018, "3rd (2018)"}, {4, 2018, "4th (2018)"}, {5, 2018, "5th (2018)"},
> {6, 2018, "6th (2018)"}, {7, 2018, "7th (2018)"}, {8, 2018, "8th (2018)"},
> {9, 2018, "9th (2018)"}, {10, 2018, "10th (2018)"}, {11, 2018, "11th (2018)"},
> {12, 2018, "12th (2018)"}, {13, 2018, "13th (2018)"}, {14, 2018, "14th (2018)"},
> {15, 2018, "15th (2018)"}, {16, 2018, "16th (2018)"}, {17, 2018, "17th (2018)"},
> {18, 2018, "18th (2018)"}, {19, 2018, "19th (2018)"}, {20, 2018, "20th (2018)"},
> {21, 2018, "21st (2018)"}, {22, 2018, "22nd (2018)"}, {23, 2018, "23rd (2018)"},
> {24, 3023, "24th (3023)"}, {25, 1000, "25th (1000)"}, {26, 318, "26th (318)"},
> {27, 2018, "27th (2018)"}, {28, 2018, "28th (2018)"}, {29, 2018, "29th (2018)"},
> {30, 2018, "30th (2018)"}, {31, 2018, "31st (2018)"}, {32, 2018, "32nd (2018)"},
> {33, 2018, "33rd (2018)"}, {34, 2018, "34th (2018)"}, {35, 2018, "35th (2018)"},
> {36, 3023, "36th (3023)"}, {37, 1000, "37th (1000)"}, {38, 318, "38th (318)"},
> {39, 2018, "39th (2018)"}, {40, 2018, "40th (2018)"}, {41, 2018, "41st (2018)"},
> {42, 2018, "42nd (2018)"}, {43, 2018, "43rd (2018)"}, {44, 2018, "44th (2018)"},
> {45, 3023, "45th (3023)"}, {46, 1000, "46th (1000)"}, {47, 318, "47th (318)"},
> {48, 3023, "48th (3023)"}, {49, 1000, "49th (1000)"}, {50, 318, "50th (318)"},
> {51, 1000, "51st (1000)"}, {52, 318, "52nd (318)"}
39a57,74
> /**
> * Testing Week Formatting from Utils with invalid values
> */
> @Test
> public void test_format_week_invalid_values_result_in_null(){
> H2msRestUtils utils = new H2msRestUtils();
> Assert.isTrue(utils.formatWeek(null,2018) == null);
> Assert.isTrue(utils.formatWeek(1,null) == null);
> Assert.isTrue(utils.formatWeek(null,null) == null);
> Assert.isTrue(utils.formatWeek(-1,2018) == null);
> Assert.isTrue(utils.formatWeek(0,2018) == null);
> Assert.isTrue(utils.formatWeek(53,2018) == null);
> Assert.isTrue(utils.formatWeek(2,-2007) == null);
> }
>
> /**
> * Tests Month Formatting from Utils with valid values
> */
42c77
< public void format_month_success(Integer month, Integer year, String result){
---
> public void test_format_month_success(Integer month, Integer year, String result){
51,54c86,90
< {2, 2018, "March (2018)"},
< {0, 2020, "January (2020)"},
< {11, 2018, "December (2018)"},
< {23, 2018, ""}
---
> // All valid values of months
> {0, 2020, "January (2020)"}, {1, 2019, "February (2019)"}, {2, 2018, "March (2018)"},
> {3, 2020, "April (2020)"}, {4, 2018, "May (2018)"}, {5, 2018, "June (2018)"},
> {6, 2020, "July (2020)"}, {7, 2018, "August (2018)"}, {8, 2018, "September (2018)"},
> {9, 2020, "October (2020)"}, {10, 2018, "November (2018)"}, {11, 2018, "December (2018)"},
57a94,110
> /**
> * Testing Week Formatting from Utils with invalid values
> */
> @Test
> public void test_format_month_invalid_values_result_in_null(){
> H2msRestUtils utils = new H2msRestUtils();
> Assert.isTrue(utils.formatMonth(null,2018) == null);
> Assert.isTrue(utils.formatMonth(12,null) == null);
> Assert.isTrue(utils.formatMonth(null,null) == null);
> Assert.isTrue(utils.formatMonth(-1,2018) == null);
> Assert.isTrue(utils.formatMonth(2,-2023) == null);
> Assert.isTrue(utils.formatMonth(12,-2023) == null);
> }
>
> /**
> * Testing Quarter Formatting from Utils with valid values
> */
60c113
< public void format_quarter_success(Integer month, Integer year, String result){
---
> public void test_format_quarter_success(Integer month, Integer year, String result){
69,71c122,126
< {2, 2018, "Q1 (2018)"},
< {0, 2020, "Q1 (2020)"},
< {11, 2018, "Q4 (2018)"},
---
> // All valid values for quarter
> {0, 2018, "Q1 (2018)"},
> {1, 2020, "Q1 (2020)"},
> {2, 2020, "Q1 (2020)"},
> {3, 2018, "Q2 (2018)"},
73c128,134
< {7, 2018, "Q3 (2018)"}
---
> {5, 2018, "Q2 (2018)"},
> {6, 2018, "Q3 (2018)"},
> {7, 2020, "Q3 (2020)"},
> {8, 2018, "Q3 (2018)"},
> {9, 2018, "Q4 (2018)"},
> {10, 2018, "Q4 (2018)"},
> {11, 2018, "Q4 (2018)"}
74a136,177
> }
>
> /**
> * Testing Quarter Formatting from Utils with invalid values
> */
> @Test
> public void test_format_quarter_invalid_values_result_in_nulls(){
> H2msRestUtils utils = new H2msRestUtils();
> Assert.isTrue(utils.formatQuarter(null,2018) == null);
> Assert.isTrue(utils.formatQuarter(12,null) == null);
> Assert.isTrue(utils.formatQuarter(null,null) == null);
> Assert.isTrue(utils.formatQuarter(-1,2018) == null);
> Assert.isTrue(utils.formatQuarter(2,-2023) == null);
> Assert.isTrue(utils.formatQuarter(12,-2023) == null);
> }
>
> /**
> * Test frequency counter successffuly returns counts in key-value map
> */
> @Test
> public void test_frequency_counter(){
> // Three occurrences of March
> List<String> parsedTimestamps = Arrays.asList("January (2020)", "March (2018)", "February (2019)",
> "April (2020)","March (2018)", "April (2020)", "March (2018)");
> Map<String, Long> counts = H2msRestUtils.frequencyCounter(parsedTimestamps);
> Assert.isTrue(counts.size() == 4);
> Assert.isTrue(counts.get("March (2018)") == 3);
> }
>
> /**
> * Tests frequency counter returns 0 count when list of timestamps is empty
> */
> @Test
> public void test_frequency_counter_when_timestamp_list_is_empty(){
> List<String> parsedTimestamps = Arrays.asList();
> Map<String, Long> counts = H2msRestUtils.frequencyCounter(parsedTimestamps);
> Assert.isTrue(counts.isEmpty());
> }
>
> @Test
> public void test_parse_timestamp_when_invalid_values(){
> Assert.isTrue(H2msRestUtils.extractParsedTimestamps(new ArrayList<>(), "week").isEmpty());
39 changes: 39 additions & 0 deletions data/diffs/2018swecapstone-h2ms-363210218-363627522
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Only in after/: bears.json
Only in after/: classpath.info
diff -r -x '*.log' -x '*.config' -x '*git*' -x '*.md' -x '*.xml' before/src/main/java/edu/harvard/h2ms/domain/core/User.java after/src/main/java/edu/harvard/h2ms/domain/core/User.java
97c97
< this.email = email;
---
> setEmail(email);
150c150,151
< this.email = email;
---
> if(email != null)
> this.email = email.toLowerCase();
diff -r -x '*.log' -x '*.config' -x '*git*' -x '*.md' -x '*.xml' before/src/main/java/edu/harvard/h2ms/service/UserDetailsServiceImpl.java after/src/main/java/edu/harvard/h2ms/service/UserDetailsServiceImpl.java
19c19
< User user = userRepository.findOneByEmail(username);
---
> User user = userRepository.findOneByEmail(username.toLowerCase());
diff -r -x '*.log' -x '*.config' -x '*git*' -x '*.md' -x '*.xml' before/src/test/java/edu/harvard/h2ms/domain/core/UserTest.java after/src/test/java/edu/harvard/h2ms/domain/core/UserTest.java
50c50,56
<
---
>
> @Test
> public void testEmailIsLowerCase() {
> User user = new User("John", "Quincy", null, "[email protected]", "password", "Other");
> assertThat(user.getEmail(), is("[email protected]"));
> }
>
diff -r -x '*.log' -x '*.config' -x '*git*' -x '*.md' -x '*.xml' before/src/test/java/edu/harvard/h2ms/service/UserDetailsServiceTest.java after/src/test/java/edu/harvard/h2ms/service/UserDetailsServiceTest.java
55a56,64
> @Test
> @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
> public void testLoadUserByUsernameIsCaseInsensitive() {
> assertThat(
> userDetailsService.loadUserByUsername("[email protected]"),
> is(user)
> );
> }
>
Empty file.
Loading