From cbe0696f82c25b0cbb4825f8553390a288d0e425 Mon Sep 17 00:00:00 2001 From: Hiroshi Miura Date: Thu, 21 Nov 2024 08:01:50 +0900 Subject: [PATCH] refactor: FalseFriendsTest - Simplify mock project by extending NotLoadedProject Signed-off-by: Hiroshi Miura --- .../languagetools/FalseFriendsTest.java | 133 +----------------- 1 file changed, 2 insertions(+), 131 deletions(-) diff --git a/test/src/org/omegat/languagetools/FalseFriendsTest.java b/test/src/org/omegat/languagetools/FalseFriendsTest.java index bf470c53f6..d1a51067a7 100644 --- a/test/src/org/omegat/languagetools/FalseFriendsTest.java +++ b/test/src/org/omegat/languagetools/FalseFriendsTest.java @@ -30,7 +30,6 @@ import static org.junit.Assert.assertTrue; import java.util.List; -import java.util.Map; import org.junit.Before; import org.junit.BeforeClass; @@ -39,19 +38,10 @@ import org.omegat.core.Core; import org.omegat.core.TestCore; -import org.omegat.core.data.EntryKey; -import org.omegat.core.data.ExternalTMX; -import org.omegat.core.data.IProject; -import org.omegat.core.data.PrepareTMXEntry; +import org.omegat.core.data.NotLoadedProject; import org.omegat.core.data.ProjectProperties; -import org.omegat.core.data.ProjectTMX; -import org.omegat.core.data.SourceTextEntry; -import org.omegat.core.data.TMXEntry; -import org.omegat.core.data.TMXEntry.ExternalLinked; -import org.omegat.core.statistics.StatisticsInfo; import org.omegat.gui.editor.mark.Mark; import org.omegat.languagetools.LanguageToolWrapper.LanguageToolMarker; -import org.omegat.tokenizer.ITokenizer; import org.omegat.util.Language; /** @@ -80,132 +70,13 @@ public Language getTargetLanguage() { return new Language("pl"); } }; - - Core.setProject(new IProject() { - public void setTranslation(SourceTextEntry entry, PrepareTMXEntry trans, - boolean defaultTranslation, TMXEntry.ExternalLinked externalLinked) { - } - - public void setTranslation(SourceTextEntry entry, PrepareTMXEntry trans, - boolean defaultTranslation, ExternalLinked externalLinked, - AllTranslations previousTranslations) throws OptimisticLockingFail { - } - - public void setNote(SourceTextEntry entry, TMXEntry oldTrans, String note) { - } - - public void saveProjectProperties() throws Exception { - } - - public void saveProject(boolean doTeamSync) { - } - - public void iterateByMultipleTranslations(MultipleTranslationsIterator it) { - } - - public void iterateByDefaultTranslations(DefaultTranslationsIterator it) { - } - - public boolean isProjectModified() { - return false; - } - + Core.setProject(new NotLoadedProject() { public boolean isProjectLoaded() { return true; } - - public boolean isOrphaned(EntryKey entry) { - return false; - } - - public boolean isOrphaned(String source) { - return false; - } - - public TMXEntry getTranslationInfo(SourceTextEntry ste) { - return null; - } - - public AllTranslations getAllTranslations(SourceTextEntry ste) { - return null; - } - - public Map getTransMemories() { - return null; - } - - public ITokenizer getTargetTokenizer() { - return null; - } - - public StatisticsInfo getStatistics() { - return null; - } - - public ITokenizer getSourceTokenizer() { - return null; - } - public ProjectProperties getProjectProperties() { return props; } - - public List getProjectFiles() { - return null; - } - - public Map getOtherTargetLanguageTMs() { - return null; - } - - public List getAllEntries() { - return null; - } - - public void compileProject(String sourcePattern) throws Exception { - } - - public void closeProject() { - } - - public List getSourceFilesOrder() { - return null; - } - - public void setSourceFilesOrder(List filesList) { - } - - @Override - public String getTargetPathForSourceFile(String sourceFile) { - return null; - } - - @Override - public boolean isTeamSyncPrepared() { - return false; - } - - @Override - public void teamSync() { - } - - @Override - public void teamSyncPrepare() throws Exception { - } - - @Override - public boolean isRemoteProject() { - return false; - } - - @Override - public void commitSourceFiles() throws Exception { - } - - @Override - public void compileProjectAndCommit(String sourcePattern, boolean doPostProcessing, - boolean commitTargetFiles) throws Exception { - } }); LanguageToolWrapper.setBridgeFromCurrentProject(); }