Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Java CI with Maven

on:
push:
branches: [ main ]
branches: [ main, feature/** ]
pull_request:
branches: [ main ]
branches: [ main, feature/** ]

jobs:
build:
Expand All @@ -16,10 +16,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '11'
distribution: 'temurin'
cache: maven
- uses: s4u/maven-settings-action@v2.6.0
Expand Down
72 changes: 0 additions & 72 deletions .gitlab-ci.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .run/All in lis-commons-lang-criteria.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All in lis-commons-lang-criteria" type="JUnit" factoryName="JUnit" nameIsGenerated="true">
<module name="lis-commons-lang-criteria" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="11" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
2 changes: 2 additions & 0 deletions .run/All in lis-commons-lang.run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All in lis-commons-lang" type="JUnit" factoryName="JUnit" nameIsGenerated="true">
<module name="lis-commons-lang" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="11" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
Expand Down
129 changes: 0 additions & 129 deletions ci_settings.xml

This file was deleted.

16 changes: 16 additions & 0 deletions lis-commons-beans/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,20 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.link_intersystems.mockito.beans;

import org.mockito.ArgumentMatcher;

import static org.mockito.internal.progress.ThreadSafeMockingProgress.*;

public class BeanMatchers {
public static <T> T propertiesEqual(Object aBean) {
reportMatcher(new PropertiesMatcher<>(aBean));
return null;
}

private static void reportMatcher(ArgumentMatcher<?> matcher) {
mockingProgress().getArgumentMatcherStorage().reportMatcher(matcher);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.link_intersystems.mockito.beans;

import com.link_intersystems.beans.Bean;
import com.link_intersystems.beans.BeansFactory;
import org.mockito.ArgumentMatcher;

public class PropertiesMatcher<T> implements ArgumentMatcher<T> {

private final Bean<T> expectedBean;

public PropertiesMatcher(T expectedBean) {
this(expectedBean, BeansFactory.getDefault());
}

public PropertiesMatcher(T expectedBean, BeansFactory beansFactory) {
this.expectedBean = beansFactory.createBean(expectedBean, Object.class);
}

@Override
public boolean matches(T argument) {
BeansFactory factory = BeansFactory.getDefault();
Bean<T> argumentBean = factory.createBean(argument, Object.class);
return expectedBean.propertiesEqual(argumentBean);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/
public class DepthFirstNodeIterator implements Iterator<Node> {

private Stack<Object> stack = new Stack<Object>();
private Stack<Object> stack = new Stack<>();

private Node next;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.function.Predicate;

import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.*;

class DepthFirstNodeIteratorTest extends AbstractNodeIteratorTest {
class DepthFirstNodeIteratorTest extends AbstractNodeIteratorTest {

@Override
protected Iterator<Node> createIterator(Node start) {
Expand All @@ -40,4 +43,24 @@ void nullArgumentConstructor() {
assertThrows(NullPointerException.class, () -> new DepthFirstNodeIterator(null));
}


@Test
void infiniteLoops() {
start = new NodeImpl("A");
NodeImpl bNode = new NodeImpl("B");
start.addReference(bNode);
bNode.addReference(start);

Iterator<Node> iterator = new DepthFirstNodeIterator(start);

assertTrue(iterator.hasNext());
assertEquals("A", iterator.next().getUserObject());

assertTrue(iterator.hasNext());
assertEquals("B", iterator.next().getUserObject());

assertTrue(iterator.hasNext());
assertEquals("A", iterator.next().getUserObject());
}

}
Loading