Skip to content
This repository was archived by the owner on Feb 10, 2021. It is now read-only.

Commit 56ab37b

Browse files
committed
Merge branch 'master' into exercise/completed
2 parents 9aa98d0 + b789e96 commit 56ab37b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

account-analytics/src/main/java/com.bobocode/AccountAnalytics.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ public List<Account> sortByFirstAndLastNames() {
104104
.collect(toList());
105105
}
106106

107+
/**
108+
* Checks if there is at least one account with provided email domain.
109+
*
110+
* @param emailDomain
111+
* @return true if there is an account that has an email with provided domain
112+
*/
113+
public boolean containsAccountWithEmailDomain(String emailDomain) {
114+
throw new UnsupportedOperationException("It's your job to implement this method"); // todo
115+
}
116+
107117
/**
108118
* Returns a {@link Map} where key is {@link Account#lastName} and values is a {@link Set} that contains first names
109119
* of all accounts with a specific last name.
@@ -169,6 +179,5 @@ public Map<Character, Long> getCharacterFrequencyIgnoreCaseInFirstAndLastNames()
169179
.collect(groupingBy(Function.identity(), counting()));
170180
}
171181

172-
173182
}
174183

account-analytics/src/test/java/com/bobocode/AccountAnalyticsTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import java.util.*;
1515

1616
import static org.junit.Assert.assertEquals;
17+
import static org.junit.Assert.assertFalse;
18+
import static org.junit.Assert.assertTrue;
1719

1820
/**
1921
* The helper method of this test class do not use Stream API intentionally. You should try to find a stream-based
@@ -118,6 +120,13 @@ public void testSortByFirstAndLastNames() {
118120

119121
}
120122

123+
@Test
124+
public void testContainsAccountWithEmailDomain() {
125+
assertTrue(analytics.containsAccountWithEmailDomain("gmail.com"));
126+
assertTrue(analytics.containsAccountWithEmailDomain("yahoo.com"));
127+
assertFalse(analytics.containsAccountWithEmailDomain("ukr.net"));
128+
}
129+
121130
@Test
122131
public void testGroupFirstNamesByLastNames() {
123132
Map<String, Set<String>> lastToFirstNamesMap = analytics.groupFirstNamesByLastNames();

0 commit comments

Comments
 (0)