forked from eclipse/eclipse-collections-kata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exercise3Test.java
70 lines (63 loc) · 2.33 KB
/
Exercise3Test.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Copyright (c) 2022 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*/
package org.eclipse.collections.companykata;
import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.api.set.MutableSet;
import org.eclipse.collections.impl.factory.Lists;
import org.eclipse.collections.impl.factory.Sets;
import org.eclipse.collections.impl.test.Verify;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
/**
* Below are links to APIs that may be helpful during these exercises.
*
* {@link MutableList#flatCollect(Function)}<br>
* {@link MutableList#collect(Function)}<br>
*
* @see <a href="http://eclipse.github.io/eclipse-collections-kata/company-kata/#/8">Exercise 3 Slides</a>
*/
public class Exercise3Test extends CompanyDomainForKata
{
/**
* Improve {@link Company#getOrders()} without breaking this test.
*/
@Test
@Tag("KATA")
public void improveGetOrders()
{
// Delete this line - it's a reminder
Assertions.fail("Improve getOrders() without breaking this test");
Verify.assertSize(5, this.company.getOrders());
}
/**
* Get all items that have been ordered by anybody.
*/
@Test
@Tag("KATA")
public void findItemNames()
{
MutableList<LineItem> allOrderedLineItems = null;
MutableSet<String> actualItemNames = null;
var expectedItemNames = Sets.mutable.with(
"shed", "big shed", "bowl", "cat", "cup", "chair", "dog",
"goldfish", "gnome", "saucer", "sofa", "table");
Assertions.assertEquals(expectedItemNames, actualItemNames);
}
@Test
@Tag("KATA")
public void findCustomerNames()
{
MutableList<String> names = null;
var expectedNames = Lists.mutable.with("Fred", "Mary", "Bill");
Assertions.assertEquals(expectedNames, names);
}
}