You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by ah...@apache.org on 2024/11/27 04:27:58 UTC
(causeway) branch v3 updated (f09b6d46acc -> 4bc8bdf4d76)
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a change to branch v3
in repository https://gitbox.apache.org/repos/asf/causeway.git
from f09b6d46acc CAUSEWAY-3815: removing todo comment
new 6f07db7717a CAUSEWAY-2297: EnumValueSemantics: don't shadow field translationService in super
new 4bc8bdf4d76 CAUSEWAY-2297: Files_deleteFileUtils_Test converted to Mockito
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../valuesemantics/EnumValueSemantics.java | 1 -
.../applib/util/Files_deleteFileUtils_Test.java | 54 +++++++++-------------
2 files changed, 23 insertions(+), 32 deletions(-)
(causeway) 01/02: CAUSEWAY-2297: EnumValueSemantics: don't shadow field translationService in super
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch v3
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 6f07db7717af1934bc4a33140c7fbdfd10b48170
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Nov 27 05:00:17 2024 +0100
CAUSEWAY-2297: EnumValueSemantics: don't shadow field translationService
in super
---
.../causeway/core/metamodel/valuesemantics/EnumValueSemantics.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/valuesemantics/EnumValueSemantics.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/valuesemantics/EnumValueSemantics.java
index be1577a1792..bbcd1beb0ec 100644
--- a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/valuesemantics/EnumValueSemantics.java
+++ b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/valuesemantics/EnumValueSemantics.java
@@ -60,7 +60,6 @@ implements
Renderer<T>,
OrderRelation<T, Void>{
- private final TranslationService translationService;
@Getter(onMethod_ = {@Override}) private final Class<T> correspondingClass;
@Getter(onMethod_ = {@Override}) @Accessors(fluent = true) private final int maxLength;
(causeway) 02/02: CAUSEWAY-2297: Files_deleteFileUtils_Test converted to Mockito
Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch v3
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 4bc8bdf4d762590c82b0eeac76502ed8e6ff6871
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Nov 27 05:27:53 2024 +0100
CAUSEWAY-2297: Files_deleteFileUtils_Test converted to Mockito
---
.../applib/util/Files_deleteFileUtils_Test.java | 54 +++++++++-------------
1 file changed, 23 insertions(+), 31 deletions(-)
diff --git a/testing/unittestsupport/applib/src/test/java/org/apache/causeway/testing/unittestsupport/applib/util/Files_deleteFileUtils_Test.java b/testing/unittestsupport/applib/src/test/java/org/apache/causeway/testing/unittestsupport/applib/util/Files_deleteFileUtils_Test.java
index 9d61faf5d1e..c179b23a81d 100644
--- a/testing/unittestsupport/applib/src/test/java/org/apache/causeway/testing/unittestsupport/applib/util/Files_deleteFileUtils_Test.java
+++ b/testing/unittestsupport/applib/src/test/java/org/apache/causeway/testing/unittestsupport/applib/util/Files_deleteFileUtils_Test.java
@@ -21,51 +21,43 @@ package org.apache.causeway.testing.unittestsupport.applib.util;
import java.io.File;
import java.io.IOException;
-import org.jmock.auto.Mock;
+import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mockito;
+
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
class Files_deleteFileUtils_Test {
- @Mock
- private FileUtils.Deleter deleter;
+ private FileUtils.Deleter deleter = Mockito.mock(FileUtils.Deleter.class);
- //@Test
- public void test() throws IOException {
+ @Test
+ void test() throws IOException {
final File cusIdxFile = new File("xml/objects/CUS.xml").getAbsoluteFile();
final File cus1File = new File("xml/objects/CUS/1.xml").getAbsoluteFile();
final File cus2File = new File("xml/objects/CUS/2.xml").getAbsoluteFile();
-// context.checking(new Expectations() {
-// {
-// oneOf(deleter).deleteFile(with(equalsFile(cusIdxFile)));
-// oneOf(deleter).deleteFile(with(equalsFile(cus1File)));
-// oneOf(deleter).deleteFile(with(equalsFile(cus2File)));
-// }
-// });
FileUtils.deleteFiles(
new File("xml/objects").getAbsoluteFile(),
FileUtils.filterFileNameExtension(".xml"),
FileUtils.Recursion.DO_RECURSE,
deleter);
+
+ verify(deleter, times(1)).deleteFile(Mockito.argThat(equalsFile(cusIdxFile)));
+ verify(deleter, times(1)).deleteFile(Mockito.argThat(equalsFile(cus1File)));
+ verify(deleter, times(1)).deleteFile(Mockito.argThat(equalsFile(cus2File)));
+ verify(deleter, times(3)).deleteFile(Mockito.any(File.class));
}
-// private static Matcher<File> equalsFile(final File file) throws IOException {
-// final String canonicalPath = file.getCanonicalPath();
-// return new TypeSafeMatcher<File>() {
-//
-// @Override
-// public void describeTo(final Description arg0) {
-// arg0.appendText("file '" + canonicalPath + "'");
-// }
-//
-// @Override
-// public boolean matchesSafely(final File arg0) {
-// try {
-// return arg0.getCanonicalPath().equals(canonicalPath);
-// } catch (IOException e) {
-// return false;
-// }
-// }
-// };
-// }
+ private static ArgumentMatcher<File> equalsFile(final File file) throws IOException {
+ return file1 -> {
+ try {
+ return file1.getCanonicalPath().equals(file.getCanonicalPath());
+ } catch (IOException e) {
+ return false;
+ }
+ };
+ }
}