</exclusion>
</exclusions>
</dependency>
- <!-- BEWARE of adding additional dependencies here...
- It will cause weird issues e.g. in integration/distribution/features/repos/distribution -->
- <dependency>
- <groupId>com.google.truth</groupId>
- <artifactId>truth</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
-
</project>
*/
package org.opendaylight.odlparent.bundlestest.lib;
-import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import java.util.Dictionary;
import java.util.HashMap;
@Test
public void testGetUsingBundleSymbolicNames() {
- assertThat(new ServiceReferenceUtil().getUsingBundleSymbolicNames(getServiceReference())).isEmpty();
+ assertEquals(List.of(), new ServiceReferenceUtil().getUsingBundleSymbolicNames(getServiceReference()));
}
@Test
public void testGetProperties() {
- assertThat(new ServiceReferenceUtil().getProperties(getServiceReference())).containsExactly(
- "property1", "value1",
- "property2", List.of("value2.1", "value2.2"),
- "property3", null);
+ final var map = new ServiceReferenceUtil().getProperties(getServiceReference());
+ assertEquals(3, map.size());
+ assertEquals("value1", map.get("property1"));
+ assertEquals(List.of("value2.1", "value2.2"), map.get("property2"));
+ // Unfortunate null;
+ assertTrue(map.containsKey("property3"));
+ assertNull(map.get("property3"));
}
private static ServiceReference<?> getServiceReference() {
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <scope>compile</scope>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <scope>compile</scope>
</dependency>
<!-- The following, which are just transitive dependencies of bundles4-test,
have to be repeated here so that the Embed-Dependency below for maven-bundle-plugin works: -->
<dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.awaitility</groupId>
- <artifactId>awaitility</artifactId>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.objenesis</groupId>
- <artifactId>objenesis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- Real <scope>test dependencies, just for SingleFeatureTestUnitTest -->
- <dependency>
- <groupId>com.google.truth</groupId>
- <artifactId>truth</artifactId>
- <scope>test</scope>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.objenesis</groupId>
+ <artifactId>objenesis</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
*/
package org.opendaylight.odlparent.featuretest;
-import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.stream.Collectors;
* @author Michael Vorburger.ch
*/
public class ReflectionUtilTest {
-
@Test
public void testGetClasses() {
- assertThat(ReflectionUtil.getClasses(getClass().getClassLoader(), "org.awaitility")
- .collect(Collectors.toList()))
- .containsAtLeast(org.awaitility.Awaitility.class, org.awaitility.core.ConditionTimeoutException.class);
+ assertTrue(ReflectionUtil.getClasses(getClass().getClassLoader(), "org.awaitility")
+ .collect(Collectors.toList())
+ .containsAll(
+ List.of(org.awaitility.Awaitility.class, org.awaitility.core.ConditionTimeoutException.class)));
}
@Test
public void testGetInnerClasses() {
List<Class<?>> innerClasses = ReflectionUtil.getClasses(
getClass().getClassLoader(), getClass().getPackage().getName()).collect(Collectors.toList());
- assertThat(innerClasses).containsAtLeast(getClass(), InnerStaticClass.class, InnerNonStaticClass.class);
- assertThat(innerClasses.stream().anyMatch(
- clazz -> clazz.getName().endsWith(getClass().getSimpleName() + "$1"))).isTrue();
- assertThat(innerClasses).containsNoDuplicates();
+ assertTrue(innerClasses.containsAll(List.of(getClass(), InnerStaticClass.class, InnerNonStaticClass.class)));
+ assertTrue(innerClasses.stream().anyMatch(
+ clazz -> clazz.getName().endsWith(getClass().getSimpleName() + "$1")));
+ assertEquals(innerClasses.stream().distinct().collect(Collectors.toList()), innerClasses);
}
@SuppressWarnings("unused")
- private final InnerNonStaticClass anoymousInnerClass = new InnerNonStaticClass() { };
+ private final InnerNonStaticClass anonymousInnerClass = new InnerNonStaticClass() {
+
+ };
private static class InnerStaticClass {
<groupId>com.google.guava</groupId>
<artifactId>guava-testlib</artifactId>
</dependency>
- <dependency>
- <groupId>com.google.truth.extensions</groupId>
- <artifactId>truth-java8-extension</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.truth</groupId>
- <artifactId>truth</artifactId>
- </dependency>
<dependency>
<groupId>com.guicedee.services</groupId>
<artifactId>javax.inject</artifactId>
<links>
<link>https://junit.org/junit4/javadoc/4.13.2/</link>
<link>http://hamcrest.org/JavaHamcrest/javadoc/2.2/</link>
- <link>http://google.github.io/truth/api/1.1/</link>
<link>http://www.slf4j.org/apidocs/</link>
<link>https://xerces.apache.org/xerces2-j/javadocs/api/</link>
<link>https://google.github.io/guava/releases/31.1-jre/api/docs/</link>
<version>2.2</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>com.google.truth</groupId>
- <artifactId>truth</artifactId>
- <!-- When bumping this version, remember to also change the JavaDoc link in odlparent-lite -->
- <version>1.1.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.truth.extensions</groupId>
- <artifactId>truth-java8-extension</artifactId>
- <version>1.1.3</version>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>