Skip to content

Commit

Permalink
#20: Outlined all tests and their dependencies to a separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
skapral committed Aug 3, 2022
1 parent b20b4e8 commit b2a0407
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 66 deletions.
4 changes: 4 additions & 0 deletions oo-memoized/memoized-chm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@
<groupId>com.pragmaticobjects.oo.memoized</groupId>
<artifactId>memoized-core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
</project>
19 changes: 0 additions & 19 deletions oo-memoized/memoized-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,4 @@
<artifactId>memoized-core</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.pragmaticobjects.oo.tests</groupId>
<artifactId>tests-junit5</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
</dependencies>
</project>

This file was deleted.

43 changes: 43 additions & 0 deletions oo-memoized/memoized-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>oo-memoized</artifactId>
<groupId>com.pragmaticobjects.oo.memoized</groupId>
<version>0.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>memoized-assertions</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>

<dependencies>
<dependency>
<groupId>com.pragmaticobjects.oo.memoized</groupId>
<artifactId>memoized-core</artifactId>
</dependency>
<dependency>
<groupId>com.pragmaticobjects.oo.memoized</groupId>
<artifactId>memoized-chm</artifactId>
</dependency>
<dependency>
<groupId>com.pragmaticobjects.oo.tests</groupId>
<artifactId>tests-junit5</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ===========================================================================
* memoized-core
* memoized-assertions
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Copyright (C) 2019 - 2022 Kapralov Sergey
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -23,13 +23,15 @@
* THE SOFTWARE.
* ============================================================================
*/
package com.pragmaticobjects.oo.memoized.core;
package com.pragmaticobjects.oo.memoized.assertions;

import com.pragmaticobjects.oo.tests.Assertion;
import org.assertj.core.api.Assertions;

import java.util.concurrent.atomic.AtomicInteger;

import com.pragmaticobjects.oo.memoized.core.Memory;

public class AssertCallTimes implements Assertion {
private final Memory memory;
private final int callNums;
Expand All @@ -44,7 +46,7 @@ public AssertCallTimes(Memory memory, int callNums, int expectedNumCalls) {
@Override
public final void check() throws Exception {
AtomicInteger counter = new AtomicInteger();
for(int i = 0; i < callNums; i++) {
for (int i = 0; i < callNums; i++) {
memory.memoized(new TestCallable(counter));
}
Assertions.assertThat(counter).hasValue(expectedNumCalls);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ===========================================================================
* memoized-core
* memoized-assertions
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Copyright (C) 2019 - 2022 Kapralov Sergey
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -23,8 +23,10 @@
* THE SOFTWARE.
* ============================================================================
*/
package com.pragmaticobjects.oo.memoized.core;
package com.pragmaticobjects.oo.memoized.assertions;

import com.pragmaticobjects.oo.memoized.core.MemoizedCallable;
import com.pragmaticobjects.oo.memoized.core.Memory;
import com.pragmaticobjects.oo.tests.Assertion;
import io.vavr.collection.List;
import org.assertj.core.api.Assertions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ===========================================================================
* memoized-core
* memoized-assertions
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Copyright (C) 2019 - 2022 Kapralov Sergey
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -23,7 +23,9 @@
* THE SOFTWARE.
* ============================================================================
*/
package com.pragmaticobjects.oo.memoized.core;
package com.pragmaticobjects.oo.memoized.assertions;

import com.pragmaticobjects.oo.memoized.core.MemoizedCallable;

import java.util.concurrent.atomic.AtomicInteger;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ===========================================================================
* memoized-core
* memoized-assertions
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Copyright (C) 2019 - 2022 Kapralov Sergey
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -23,7 +23,7 @@
* THE SOFTWARE.
* ============================================================================
*/
package com.pragmaticobjects.oo.memoized.core;
package com.pragmaticobjects.oo.memoized.assertions;

import com.pragmaticobjects.oo.tests.AssertAssertionPasses;
import com.pragmaticobjects.oo.tests.TestCase;
Expand All @@ -40,8 +40,8 @@ public AssertCallTimesTest() {
new AssertAssertionPasses(
new AssertCallTimes(
new BluntMemory(),
10,
10
10,
10
)
)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ===========================================================================
* memoized-core
* memoized-assertions
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Copyright (C) 2019 - 2022 Kapralov Sergey
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -23,7 +23,7 @@
* THE SOFTWARE.
* ============================================================================
*/
package com.pragmaticobjects.oo.memoized.core;
package com.pragmaticobjects.oo.memoized.assertions;

import com.pragmaticobjects.oo.tests.AssertAssertionPasses;
import com.pragmaticobjects.oo.tests.TestCase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ===========================================================================
* memoized-core
* memoized-assertions
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Copyright (C) 2019 - 2022 Kapralov Sergey
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -23,10 +23,14 @@
* THE SOFTWARE.
* ============================================================================
*/
package com.pragmaticobjects.oo.memoized.core;
package com.pragmaticobjects.oo.memoized.assertions;

import com.pragmaticobjects.oo.memoized.core.MemoizedCallable;
import com.pragmaticobjects.oo.memoized.core.Memory;

import java.util.Optional;


/**
* Test {@link Memory} implementation that memoises nothing
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ===========================================================================
* memoized-core
* memoized-assertions
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Copyright (C) 2019 - 2022 Kapralov Sergey
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -23,4 +23,4 @@
* THE SOFTWARE.
* ============================================================================
*/
package com.pragmaticobjects.oo.memoized.core;
package com.pragmaticobjects.oo.memoized.assertions;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ===========================================================================
* memoized-chm
* memoized-assertions
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Copyright (C) 2019 - 2022 Kapralov Sergey
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -26,8 +26,8 @@
package com.pragmaticobjects.oo.memoized.chm;


import com.pragmaticobjects.oo.memoized.core.AssertCallTimes;
import com.pragmaticobjects.oo.memoized.core.AssertDisposal;
import com.pragmaticobjects.oo.memoized.assertions.AssertCallTimes;
import com.pragmaticobjects.oo.memoized.assertions.AssertDisposal;
import com.pragmaticobjects.oo.memoized.core.MemoizedCallable;
import com.pragmaticobjects.oo.tests.TestCase;
import com.pragmaticobjects.oo.tests.junit5.TestsSuite;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*-
* ===========================================================================
* memoized-chm
* memoized-assertions
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Copyright (C) 2019 - 2022 Kapralov Sergey
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
11 changes: 11 additions & 0 deletions oo-memoized/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<modules>
<module>memoized-core</module>
<module>memoized-chm</module>
<module>memoized-tests</module>
</modules>

<dependencyManagement>
Expand All @@ -47,6 +48,16 @@
<artifactId>memoized-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.pragmaticobjects.oo.memoized</groupId>
<artifactId>memoized-assertions</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.pragmaticobjects.oo.memoized</groupId>
<artifactId>memoized-chm</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.pragmaticobjects.oo.tests</groupId>
<artifactId>tests-junit5</artifactId>
Expand Down

0 comments on commit b2a0407

Please sign in to comment.