blob: bf8f9aba4ba185b16a818b2eb283ebead096956f [file] [log] [blame]
Michael Staib5e573fd2016-01-27 00:33:29 +00001// Copyright 2015 The Bazel Authors. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14package com.google.devtools.build.lib.analysis;
15
16import static com.google.common.truth.Truth.assertThat;
17import static org.junit.Assert.fail;
18
19import com.google.common.collect.ImmutableMap;
20import com.google.common.collect.ImmutableSet;
21import com.google.common.testing.EqualsTester;
22import com.google.common.testing.NullPointerTester;
23import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
gregcec7b21212017-12-21 12:40:20 -080024import com.google.devtools.build.lib.analysis.config.HostTransition;
gregce7fa23ea2018-01-18 12:46:04 -080025import com.google.devtools.build.lib.analysis.config.transitions.NoTransition;
Michael Staib5e573fd2016-01-27 00:33:29 +000026import com.google.devtools.build.lib.analysis.util.AnalysisTestCase;
27import com.google.devtools.build.lib.analysis.util.TestAspects;
28import com.google.devtools.build.lib.cmdline.Label;
Dmitry Lomov15756522016-12-16 16:52:37 +000029import com.google.devtools.build.lib.packages.AspectDescriptor;
Michael Staib5e573fd2016-01-27 00:33:29 +000030import org.junit.Test;
31import org.junit.runner.RunWith;
32import org.junit.runners.JUnit4;
33
Michael Staib5e573fd2016-01-27 00:33:29 +000034/**
35 * Tests for {@link Dependency}.
36 *
37 * <p>Although this is just a data class, we need a way to create a configuration.
38 */
39@RunWith(JUnit4.class)
40public class DependencyTest extends AnalysisTestCase {
41 @Test
42 public void withNullConfiguration_BasicAccessors() throws Exception {
dannark90e2b4b2018-06-27 13:35:04 -070043 Dependency nullDep =
44 Dependency.withNullConfiguration(Label.parseAbsolute("//a", ImmutableMap.of()));
Michael Staib5e573fd2016-01-27 00:33:29 +000045
dannark90e2b4b2018-06-27 13:35:04 -070046 assertThat(nullDep.getLabel()).isEqualTo(Label.parseAbsolute("//a", ImmutableMap.of()));
gregcee0bbe752017-09-12 23:58:34 +020047 assertThat(nullDep.hasExplicitConfiguration()).isTrue();
Michael Staib5e573fd2016-01-27 00:33:29 +000048 assertThat(nullDep.getConfiguration()).isNull();
Dmitry Lomove851fe22017-02-14 23:11:23 +000049 assertThat(nullDep.getAspects().getAllAspects()).isEmpty();
Michael Staib5e573fd2016-01-27 00:33:29 +000050
51 try {
52 nullDep.getTransition();
53 fail("withNullConfiguration-created Dependencies should throw ISE on getTransition()");
54 } catch (IllegalStateException ex) {
55 // good. expected.
56 }
57 }
58
59 @Test
60 public void withConfiguration_BasicAccessors() throws Exception {
61 update();
62 Dependency targetDep =
dannark90e2b4b2018-06-27 13:35:04 -070063 Dependency.withConfiguration(
64 Label.parseAbsolute("//a", ImmutableMap.of()), getTargetConfiguration());
Michael Staib5e573fd2016-01-27 00:33:29 +000065
dannark90e2b4b2018-06-27 13:35:04 -070066 assertThat(targetDep.getLabel()).isEqualTo(Label.parseAbsolute("//a", ImmutableMap.of()));
gregcee0bbe752017-09-12 23:58:34 +020067 assertThat(targetDep.hasExplicitConfiguration()).isTrue();
Michael Staib5e573fd2016-01-27 00:33:29 +000068 assertThat(targetDep.getConfiguration()).isEqualTo(getTargetConfiguration());
Dmitry Lomove851fe22017-02-14 23:11:23 +000069 assertThat(targetDep.getAspects().getAllAspects()).isEmpty();
Michael Staib5e573fd2016-01-27 00:33:29 +000070
71 try {
72 targetDep.getTransition();
73 fail("withConfiguration-created Dependencies should throw ISE on getTransition()");
74 } catch (IllegalStateException ex) {
75 // good. expected.
76 }
77 }
78
79 @Test
80 public void withConfigurationAndAspects_BasicAccessors() throws Exception {
81 update();
Luis Fernando Pino Duquee82713d2016-04-26 16:22:38 +000082 AspectDescriptor simpleAspect = new AspectDescriptor(TestAspects.SIMPLE_ASPECT);
83 AspectDescriptor attributeAspect = new AspectDescriptor(TestAspects.ATTRIBUTE_ASPECT);
Dmitry Lomove851fe22017-02-14 23:11:23 +000084 AspectCollection twoAspects = AspectCollection.createForTests(
85 ImmutableSet.of(simpleAspect, attributeAspect));
Michael Staib5e573fd2016-01-27 00:33:29 +000086 Dependency targetDep =
87 Dependency.withConfigurationAndAspects(
dannark90e2b4b2018-06-27 13:35:04 -070088 Label.parseAbsolute("//a", ImmutableMap.of()), getTargetConfiguration(), twoAspects);
Michael Staib5e573fd2016-01-27 00:33:29 +000089
dannark90e2b4b2018-06-27 13:35:04 -070090 assertThat(targetDep.getLabel()).isEqualTo(Label.parseAbsolute("//a", ImmutableMap.of()));
gregcee0bbe752017-09-12 23:58:34 +020091 assertThat(targetDep.hasExplicitConfiguration()).isTrue();
Michael Staib5e573fd2016-01-27 00:33:29 +000092 assertThat(targetDep.getConfiguration()).isEqualTo(getTargetConfiguration());
Dmitry Lomove851fe22017-02-14 23:11:23 +000093 assertThat(targetDep.getAspects()).isEqualTo(twoAspects);
94 assertThat(targetDep.getAspectConfiguration(simpleAspect)).isEqualTo(getTargetConfiguration());
95 assertThat(targetDep.getAspectConfiguration(attributeAspect))
96 .isEqualTo(getTargetConfiguration());
Michael Staib5e573fd2016-01-27 00:33:29 +000097
98 try {
99 targetDep.getTransition();
100 fail("withConfigurationAndAspects-created Dependencies should throw ISE on getTransition()");
101 } catch (IllegalStateException ex) {
102 // good. that's what I WANTED to happen.
103 }
104 }
105
106 @Test
Michael Staib5e573fd2016-01-27 00:33:29 +0000107 public void withConfigurationAndAspects_RejectsNullConfigWithNPE() throws Exception {
108 // Although the NullPointerTester should check this, this test invokes a different code path,
109 // because it includes aspects (which the NPT test will not).
Luis Fernando Pino Duquee82713d2016-04-26 16:22:38 +0000110 AspectDescriptor simpleAspect = new AspectDescriptor(TestAspects.SIMPLE_ASPECT);
111 AspectDescriptor attributeAspect = new AspectDescriptor(TestAspects.ATTRIBUTE_ASPECT);
Dmitry Lomove851fe22017-02-14 23:11:23 +0000112 AspectCollection twoAspects = AspectCollection.createForTests(simpleAspect, attributeAspect);
Michael Staib5e573fd2016-01-27 00:33:29 +0000113
114 try {
dannark90e2b4b2018-06-27 13:35:04 -0700115 Dependency.withConfigurationAndAspects(
116 Label.parseAbsolute("//a", ImmutableMap.of()), null, twoAspects);
Michael Staib5e573fd2016-01-27 00:33:29 +0000117 fail("should not be allowed to create a dependency with a null configuration");
118 } catch (NullPointerException expected) {
119 // good. you fell rrrrright into my trap.
120 }
121 }
122
123 @Test
124 public void withConfigurationAndAspects_AllowsEmptyAspectSet() throws Exception {
125 update();
126 Dependency dep =
127 Dependency.withConfigurationAndAspects(
dannark90e2b4b2018-06-27 13:35:04 -0700128 Label.parseAbsolute("//a", ImmutableMap.of()),
Dmitry Lomove8040172016-04-06 14:53:43 +0000129 getTargetConfiguration(),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000130 AspectCollection.EMPTY);
Michael Staib5e573fd2016-01-27 00:33:29 +0000131 // Here we're also checking that this doesn't throw an exception. No boom? OK. Good.
Dmitry Lomove851fe22017-02-14 23:11:23 +0000132 assertThat(dep.getAspects().getAllAspects()).isEmpty();
Michael Staib5e573fd2016-01-27 00:33:29 +0000133 }
134
135 @Test
136 public void withConfiguredAspects_BasicAccessors() throws Exception {
137 update();
Luis Fernando Pino Duquee82713d2016-04-26 16:22:38 +0000138 AspectDescriptor simpleAspect = new AspectDescriptor(TestAspects.SIMPLE_ASPECT);
139 AspectDescriptor attributeAspect = new AspectDescriptor(TestAspects.ATTRIBUTE_ASPECT);
Dmitry Lomove851fe22017-02-14 23:11:23 +0000140 AspectCollection aspects =
141 AspectCollection.createForTests(ImmutableSet.of(simpleAspect, attributeAspect));
Dmitry Lomove8040172016-04-06 14:53:43 +0000142 ImmutableMap<AspectDescriptor, BuildConfiguration> twoAspectMap = ImmutableMap.of(
Michael Staib5e573fd2016-01-27 00:33:29 +0000143 simpleAspect, getTargetConfiguration(), attributeAspect, getHostConfiguration());
144 Dependency targetDep =
145 Dependency.withConfiguredAspects(
dannark90e2b4b2018-06-27 13:35:04 -0700146 Label.parseAbsolute("//a", ImmutableMap.of()),
147 getTargetConfiguration(),
148 aspects,
149 twoAspectMap);
Michael Staib5e573fd2016-01-27 00:33:29 +0000150
dannark90e2b4b2018-06-27 13:35:04 -0700151 assertThat(targetDep.getLabel()).isEqualTo(Label.parseAbsolute("//a", ImmutableMap.of()));
gregcee0bbe752017-09-12 23:58:34 +0200152 assertThat(targetDep.hasExplicitConfiguration()).isTrue();
Michael Staib5e573fd2016-01-27 00:33:29 +0000153 assertThat(targetDep.getConfiguration()).isEqualTo(getTargetConfiguration());
Dmitry Lomove851fe22017-02-14 23:11:23 +0000154 assertThat(targetDep.getAspects().getAllAspects())
lberkiaea56b32017-05-30 12:35:33 +0200155 .containsExactly(simpleAspect, attributeAspect);
Dmitry Lomove851fe22017-02-14 23:11:23 +0000156 assertThat(targetDep.getAspectConfiguration(simpleAspect)).isEqualTo(getTargetConfiguration());
157 assertThat(targetDep.getAspectConfiguration(attributeAspect))
158 .isEqualTo(getHostConfiguration());
Michael Staib5e573fd2016-01-27 00:33:29 +0000159
160 try {
161 targetDep.getTransition();
162 fail("withConfiguredAspects-created Dependencies should throw ISE on getTransition()");
163 } catch (IllegalStateException ex) {
164 // good. all according to keikaku. (TL note: keikaku means plan)
165 }
166 }
167
168
169 @Test
170 public void withConfiguredAspects_AllowsEmptyAspectMap() throws Exception {
171 update();
172 Dependency dep =
173 Dependency.withConfiguredAspects(
dannark90e2b4b2018-06-27 13:35:04 -0700174 Label.parseAbsolute("//a", ImmutableMap.of()),
175 getTargetConfiguration(),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000176 AspectCollection.EMPTY,
Dmitry Lomove8040172016-04-06 14:53:43 +0000177 ImmutableMap.<AspectDescriptor, BuildConfiguration>of());
Michael Staib5e573fd2016-01-27 00:33:29 +0000178 // Here we're also checking that this doesn't throw an exception. No boom? OK. Good.
Dmitry Lomove851fe22017-02-14 23:11:23 +0000179 assertThat(dep.getAspects().getAllAspects()).isEmpty();
Michael Staib5e573fd2016-01-27 00:33:29 +0000180 }
181
182 @Test
183 public void withTransitionAndAspects_BasicAccessors() throws Exception {
Luis Fernando Pino Duquee82713d2016-04-26 16:22:38 +0000184 AspectDescriptor simpleAspect = new AspectDescriptor(TestAspects.SIMPLE_ASPECT);
185 AspectDescriptor attributeAspect = new AspectDescriptor(TestAspects.ATTRIBUTE_ASPECT);
Dmitry Lomove851fe22017-02-14 23:11:23 +0000186 AspectCollection twoAspects = AspectCollection.createForTests(
187 ImmutableSet.of(simpleAspect, attributeAspect));
Michael Staib5e573fd2016-01-27 00:33:29 +0000188 Dependency hostDep =
189 Dependency.withTransitionAndAspects(
dannark90e2b4b2018-06-27 13:35:04 -0700190 Label.parseAbsolute("//a", ImmutableMap.of()), HostTransition.INSTANCE, twoAspects);
Michael Staib5e573fd2016-01-27 00:33:29 +0000191
dannark90e2b4b2018-06-27 13:35:04 -0700192 assertThat(hostDep.getLabel()).isEqualTo(Label.parseAbsolute("//a", ImmutableMap.of()));
gregcee0bbe752017-09-12 23:58:34 +0200193 assertThat(hostDep.hasExplicitConfiguration()).isFalse();
Dmitry Lomove851fe22017-02-14 23:11:23 +0000194 assertThat(hostDep.getAspects().getAllAspects())
195 .containsExactlyElementsIn(twoAspects.getAllAspects());
gregcec7b21212017-12-21 12:40:20 -0800196 assertThat(hostDep.getTransition().isHostTransition()).isTrue();
Michael Staib5e573fd2016-01-27 00:33:29 +0000197
198 try {
199 hostDep.getConfiguration();
200 fail("withTransitionAndAspects-created Dependencies should throw ISE on getConfiguration()");
201 } catch (IllegalStateException ex) {
202 // good. I knew you would do that.
203 }
204
205 try {
Dmitry Lomove851fe22017-02-14 23:11:23 +0000206 hostDep.getAspectConfiguration(simpleAspect);
Michael Staib5e573fd2016-01-27 00:33:29 +0000207 fail("withTransitionAndAspects-created Dependencies should throw ISE on "
Dmitry Lomove851fe22017-02-14 23:11:23 +0000208 + "getAspectConfiguration()");
209 } catch (IllegalStateException ex) {
210 // good. you're so predictable.
211 }
212
213 try {
214 hostDep.getAspectConfiguration(attributeAspect);
215 fail("withTransitionAndAspects-created Dependencies should throw ISE on "
216 + "getAspectConfiguration()");
Michael Staib5e573fd2016-01-27 00:33:29 +0000217 } catch (IllegalStateException ex) {
218 // good. you're so predictable.
219 }
220 }
221
222 @Test
223 public void withTransitionAndAspects_AllowsEmptyAspectSet() throws Exception {
224 update();
225 Dependency dep =
226 Dependency.withTransitionAndAspects(
dannark90e2b4b2018-06-27 13:35:04 -0700227 Label.parseAbsolute("//a", ImmutableMap.of()),
228 HostTransition.INSTANCE,
Dmitry Lomove851fe22017-02-14 23:11:23 +0000229 AspectCollection.EMPTY);
Michael Staib5e573fd2016-01-27 00:33:29 +0000230 // Here we're also checking that this doesn't throw an exception. No boom? OK. Good.
Dmitry Lomove851fe22017-02-14 23:11:23 +0000231 assertThat(dep.getAspects().getAllAspects()).isEmpty();
Michael Staib5e573fd2016-01-27 00:33:29 +0000232 }
233
234 @Test
235 public void factoriesPassNullableTester() throws Exception {
236 update();
237
238 new NullPointerTester()
dannark90e2b4b2018-06-27 13:35:04 -0700239 .setDefault(Label.class, Label.parseAbsolute("//a", ImmutableMap.of()))
Michael Staib5e573fd2016-01-27 00:33:29 +0000240 .setDefault(BuildConfiguration.class, getTargetConfiguration())
241 .testAllPublicStaticMethods(Dependency.class);
242 }
243
244 @Test
245 public void equalsPassesEqualsTester() throws Exception {
246 update();
247
dannark90e2b4b2018-06-27 13:35:04 -0700248 Label a = Label.parseAbsolute("//a", ImmutableMap.of());
249 Label aExplicit = Label.parseAbsolute("//a:a", ImmutableMap.of());
250 Label b = Label.parseAbsolute("//b", ImmutableMap.of());
Michael Staib5e573fd2016-01-27 00:33:29 +0000251
252 BuildConfiguration host = getHostConfiguration();
253 BuildConfiguration target = getTargetConfiguration();
254
Luis Fernando Pino Duquee82713d2016-04-26 16:22:38 +0000255 AspectDescriptor simpleAspect = new AspectDescriptor(TestAspects.SIMPLE_ASPECT);
256 AspectDescriptor attributeAspect = new AspectDescriptor(TestAspects.ATTRIBUTE_ASPECT);
257 AspectDescriptor errorAspect = new AspectDescriptor(TestAspects.ERROR_ASPECT);
Michael Staib5e573fd2016-01-27 00:33:29 +0000258
Dmitry Lomove851fe22017-02-14 23:11:23 +0000259 AspectCollection twoAspects =
260 AspectCollection.createForTests(simpleAspect, attributeAspect);
261 AspectCollection inverseAspects =
262 AspectCollection.createForTests(attributeAspect, simpleAspect);
263 AspectCollection differentAspects =
264 AspectCollection.createForTests(attributeAspect, errorAspect);
265 AspectCollection noAspects = AspectCollection.EMPTY;
Michael Staib5e573fd2016-01-27 00:33:29 +0000266
Dmitry Lomove8040172016-04-06 14:53:43 +0000267 ImmutableMap<AspectDescriptor, BuildConfiguration> twoAspectsHostMap =
Michael Staib5e573fd2016-01-27 00:33:29 +0000268 ImmutableMap.of(simpleAspect, host, attributeAspect, host);
Dmitry Lomove8040172016-04-06 14:53:43 +0000269 ImmutableMap<AspectDescriptor, BuildConfiguration> twoAspectsTargetMap =
Michael Staib5e573fd2016-01-27 00:33:29 +0000270 ImmutableMap.of(simpleAspect, target, attributeAspect, target);
Dmitry Lomove8040172016-04-06 14:53:43 +0000271 ImmutableMap<AspectDescriptor, BuildConfiguration> differentAspectsHostMap =
Michael Staib5e573fd2016-01-27 00:33:29 +0000272 ImmutableMap.of(attributeAspect, host, errorAspect, host);
Dmitry Lomove8040172016-04-06 14:53:43 +0000273 ImmutableMap<AspectDescriptor, BuildConfiguration> differentAspectsTargetMap =
Michael Staib5e573fd2016-01-27 00:33:29 +0000274 ImmutableMap.of(attributeAspect, target, errorAspect, target);
Dmitry Lomove8040172016-04-06 14:53:43 +0000275 ImmutableMap<AspectDescriptor, BuildConfiguration> noAspectsMap =
276 ImmutableMap.<AspectDescriptor, BuildConfiguration>of();
Michael Staib5e573fd2016-01-27 00:33:29 +0000277
278 new EqualsTester()
279 .addEqualityGroup(
280 // base set: //a, host configuration, normal aspect set
281 Dependency.withConfigurationAndAspects(a, host, twoAspects),
282 Dependency.withConfigurationAndAspects(aExplicit, host, twoAspects),
283 Dependency.withConfigurationAndAspects(a, host, inverseAspects),
284 Dependency.withConfigurationAndAspects(aExplicit, host, inverseAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000285 Dependency.withConfiguredAspects(a, host, twoAspects, twoAspectsHostMap),
286 Dependency.withConfiguredAspects(aExplicit, host, twoAspects, twoAspectsHostMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000287 .addEqualityGroup(
288 // base set but with label //b
289 Dependency.withConfigurationAndAspects(b, host, twoAspects),
290 Dependency.withConfigurationAndAspects(b, host, inverseAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000291 Dependency.withConfiguredAspects(b, host, twoAspects, twoAspectsHostMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000292 .addEqualityGroup(
293 // base set but with target configuration
294 Dependency.withConfigurationAndAspects(a, target, twoAspects),
295 Dependency.withConfigurationAndAspects(aExplicit, target, twoAspects),
296 Dependency.withConfigurationAndAspects(a, target, inverseAspects),
297 Dependency.withConfigurationAndAspects(aExplicit, target, inverseAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000298 Dependency.withConfiguredAspects(a, target, twoAspects, twoAspectsTargetMap),
299 Dependency.withConfiguredAspects(aExplicit, target, twoAspects, twoAspectsTargetMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000300 .addEqualityGroup(
301 // base set but with null configuration
302 Dependency.withNullConfiguration(a),
303 Dependency.withNullConfiguration(aExplicit))
304 .addEqualityGroup(
305 // base set but with different aspects
306 Dependency.withConfigurationAndAspects(a, host, differentAspects),
307 Dependency.withConfigurationAndAspects(aExplicit, host, differentAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000308 Dependency.withConfiguredAspects(
309 a, host, differentAspects, differentAspectsHostMap),
310 Dependency.withConfiguredAspects(
311 aExplicit, host, differentAspects, differentAspectsHostMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000312 .addEqualityGroup(
313 // base set but with label //b and target configuration
314 Dependency.withConfigurationAndAspects(b, target, twoAspects),
315 Dependency.withConfigurationAndAspects(b, target, inverseAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000316 Dependency.withConfiguredAspects(b, target,
317 twoAspects, twoAspectsTargetMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000318 .addEqualityGroup(
319 // base set but with label //b and null configuration
320 Dependency.withNullConfiguration(b))
321 .addEqualityGroup(
322 // base set but with label //b and different aspects
323 Dependency.withConfigurationAndAspects(b, host, differentAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000324 Dependency.withConfiguredAspects(
325 b, host, differentAspects, differentAspectsHostMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000326 .addEqualityGroup(
327 // base set but with target configuration and different aspects
328 Dependency.withConfigurationAndAspects(a, target, differentAspects),
329 Dependency.withConfigurationAndAspects(aExplicit, target, differentAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000330 Dependency.withConfiguredAspects(
331 a, target, differentAspects, differentAspectsTargetMap),
332 Dependency.withConfiguredAspects(
333 aExplicit, target, differentAspects, differentAspectsTargetMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000334 .addEqualityGroup(
335 // inverse of base set: //b, target configuration, different aspects
336 Dependency.withConfigurationAndAspects(b, target, differentAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000337 Dependency.withConfiguredAspects(
338 b, target, differentAspects, differentAspectsTargetMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000339 .addEqualityGroup(
340 // base set but with no aspects
341 Dependency.withConfiguration(a, host),
342 Dependency.withConfiguration(aExplicit, host),
343 Dependency.withConfigurationAndAspects(a, host, noAspects),
344 Dependency.withConfigurationAndAspects(aExplicit, host, noAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000345 Dependency.withConfiguredAspects(a, host, noAspects, noAspectsMap),
346 Dependency.withConfiguredAspects(aExplicit, host, noAspects, noAspectsMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000347 .addEqualityGroup(
348 // base set but with label //b and no aspects
349 Dependency.withConfiguration(b, host),
350 Dependency.withConfigurationAndAspects(b, host, noAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000351 Dependency.withConfiguredAspects(b, host, noAspects, noAspectsMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000352 .addEqualityGroup(
353 // base set but with target configuration and no aspects
354 Dependency.withConfiguration(a, target),
355 Dependency.withConfiguration(aExplicit, target),
356 Dependency.withConfigurationAndAspects(a, target, noAspects),
357 Dependency.withConfigurationAndAspects(aExplicit, target, noAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000358 Dependency.withConfiguredAspects(a, target, noAspects, noAspectsMap),
359 Dependency.withConfiguredAspects(aExplicit, target, noAspects, noAspectsMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000360 .addEqualityGroup(
361 // inverse of base set: //b, target configuration, no aspects
362 Dependency.withConfiguration(b, target),
363 Dependency.withConfigurationAndAspects(b, target, noAspects),
Dmitry Lomove851fe22017-02-14 23:11:23 +0000364 Dependency.withConfiguredAspects(b, target, noAspects, noAspectsMap))
Michael Staib5e573fd2016-01-27 00:33:29 +0000365 .addEqualityGroup(
366 // base set but with transition HOST
gregcec7b21212017-12-21 12:40:20 -0800367 Dependency.withTransitionAndAspects(a, HostTransition.INSTANCE, twoAspects),
Michael Staib5e573fd2016-01-27 00:33:29 +0000368 Dependency.withTransitionAndAspects(
gregcec7b21212017-12-21 12:40:20 -0800369 aExplicit, HostTransition.INSTANCE, twoAspects),
370 Dependency.withTransitionAndAspects(a, HostTransition.INSTANCE, inverseAspects),
Michael Staib5e573fd2016-01-27 00:33:29 +0000371 Dependency.withTransitionAndAspects(
gregcec7b21212017-12-21 12:40:20 -0800372 aExplicit, HostTransition.INSTANCE, inverseAspects))
Michael Staib5e573fd2016-01-27 00:33:29 +0000373 .addEqualityGroup(
374 // base set but with transition HOST and different aspects
gregcec7b21212017-12-21 12:40:20 -0800375 Dependency.withTransitionAndAspects(a, HostTransition.INSTANCE, differentAspects),
Michael Staib5e573fd2016-01-27 00:33:29 +0000376 Dependency.withTransitionAndAspects(
gregcec7b21212017-12-21 12:40:20 -0800377 aExplicit, HostTransition.INSTANCE, differentAspects))
Michael Staib5e573fd2016-01-27 00:33:29 +0000378 .addEqualityGroup(
379 // base set but with transition HOST and label //b
gregcec7b21212017-12-21 12:40:20 -0800380 Dependency.withTransitionAndAspects(b, HostTransition.INSTANCE, twoAspects),
381 Dependency.withTransitionAndAspects(b, HostTransition.INSTANCE, inverseAspects))
Michael Staib5e573fd2016-01-27 00:33:29 +0000382 .addEqualityGroup(
383 // inverse of base set: transition HOST, label //b, different aspects
gregcec7b21212017-12-21 12:40:20 -0800384 Dependency.withTransitionAndAspects(b, HostTransition.INSTANCE, differentAspects),
385 Dependency.withTransitionAndAspects(b, HostTransition.INSTANCE, differentAspects))
Michael Staib5e573fd2016-01-27 00:33:29 +0000386 .addEqualityGroup(
387 // base set but with transition NONE
gregce7fa23ea2018-01-18 12:46:04 -0800388 Dependency.withTransitionAndAspects(a, NoTransition.INSTANCE, twoAspects),
389 Dependency.withTransitionAndAspects(aExplicit, NoTransition.INSTANCE, twoAspects),
390 Dependency.withTransitionAndAspects(a, NoTransition.INSTANCE, inverseAspects),
391 Dependency.withTransitionAndAspects(aExplicit, NoTransition.INSTANCE, inverseAspects))
Michael Staib5e573fd2016-01-27 00:33:29 +0000392 .addEqualityGroup(
393 // base set but with transition NONE and different aspects
gregce7fa23ea2018-01-18 12:46:04 -0800394 Dependency.withTransitionAndAspects(a, NoTransition.INSTANCE, differentAspects),
395 Dependency.withTransitionAndAspects(aExplicit, NoTransition.INSTANCE, differentAspects))
Michael Staib5e573fd2016-01-27 00:33:29 +0000396 .addEqualityGroup(
397 // base set but with transition NONE and label //b
gregce7fa23ea2018-01-18 12:46:04 -0800398 Dependency.withTransitionAndAspects(b, NoTransition.INSTANCE, twoAspects),
399 Dependency.withTransitionAndAspects(b, NoTransition.INSTANCE, inverseAspects))
Michael Staib5e573fd2016-01-27 00:33:29 +0000400 .addEqualityGroup(
401 // inverse of base set: transition NONE, label //b, different aspects
gregce7fa23ea2018-01-18 12:46:04 -0800402 Dependency.withTransitionAndAspects(b, NoTransition.INSTANCE, differentAspects),
403 Dependency.withTransitionAndAspects(b, NoTransition.INSTANCE, differentAspects))
Michael Staib5e573fd2016-01-27 00:33:29 +0000404 .testEquals();
405 }
406}