Skip to content

Commit

Permalink
r optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsEckart committed Jan 31, 2022
1 parent 76f942b commit 28e7351
Show file tree
Hide file tree
Showing 279 changed files with 842 additions and 999 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

public class WritableUtils
{

public static <T> T createWritable(Object value, Class<T> writableType) throws InstantiationException,
IllegalAccessException, InvocationTargetException, NoSuchMethodException
public static <T> T createWritable(Object value, Class<T> writableType)
throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
{
if (writableType.isInstance(value)) { return (T) value; }
if (writableType.isInstance(value))
{ return (T) value; }
Object writable = writableType.newInstance();
try
{
Expand All @@ -31,8 +31,8 @@ public static <T> T createWritable(Object value, Class<T> writableType) throws I
}
catch (Exception e)
{
throw new RuntimeException(String.format("Could not convert %s => %s", value.getClass().getName(),
writableType.getName()), e);
throw new RuntimeException(
String.format("Could not convert %s => %s", value.getClass().getName(), writableType.getName()), e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

public abstract class SmartMapper<KeyIn, ValueIn, KeyOut, ValueOut>
extends
Mapper<KeyIn, ValueIn, KeyOut, ValueOut> implements Transform<KeyIn, ValueIn, KeyOut, ValueOut>
Mapper<KeyIn, ValueIn, KeyOut, ValueOut>
implements
Transform<KeyIn, ValueIn, KeyOut, ValueOut>
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

public abstract class SmartReducer<KeyIn, ValueIn, KeyOut, ValueOut>
extends
Reducer<KeyIn, ValueIn, KeyOut, ValueOut> implements Transform<KeyIn, ValueIn, KeyOut, ValueOut>
Reducer<KeyIn, ValueIn, KeyOut, ValueOut>
implements
Transform<KeyIn, ValueIn, KeyOut, ValueOut>
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class MapperWrapper<KeyIn, ValueIn, KeyOut, ValueOut>
private final Class<KeyOut> keyOut;
private final Class<ValueOut> valueOut;
private final Mapper<KeyIn, ValueIn, KeyOut, ValueOut> mapper;
public MapperWrapper(Mapper<KeyIn, ValueIn, KeyOut, ValueOut> mapper, Class<KeyIn> keyIn,
Class<ValueIn> valueIn, Class<KeyOut> keyOut, Class<ValueOut> valueOut)
public MapperWrapper(Mapper<KeyIn, ValueIn, KeyOut, ValueOut> mapper, Class<KeyIn> keyIn, Class<ValueIn> valueIn,
Class<KeyOut> keyOut, Class<ValueOut> valueOut)
{
this.mapper = mapper;
this.keyIn = keyIn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ public class HadoopApprovalsTest extends TestCase
{
public void testMap() throws Exception
{
SmartMapper<LongWritable, Text, Text, LongWritable> mapper = new MapperWrapper<>(new WordCountMap(), LongWritable.class, Text.class, Text.class,
LongWritable.class);
SmartMapper<LongWritable, Text, Text, LongWritable> mapper = new MapperWrapper<>(new WordCountMap(),
LongWritable.class, Text.class, Text.class, LongWritable.class);
HadoopApprovals.verifyMapping(mapper, 0, "llew gen llew");
}
public void testReduce() throws Exception
{
SmartReducer<Text, LongWritable, Text, LongWritable> reducer = new ReducerWrapper<>(new WordCountReduce(), Text.class, LongWritable.class, Text.class,
LongWritable.class);
SmartReducer<Text, LongWritable, Text, LongWritable> reducer = new ReducerWrapper<>(new WordCountReduce(),
Text.class, LongWritable.class, Text.class, LongWritable.class);
HadoopApprovals.verifyReducer(reducer, "life", 7, 35);
}
public void testMapReducer() throws Exception
{
SmartMapper<LongWritable, Text, Text, LongWritable> mapper = new MapperWrapper<>(new WordCountMap(), LongWritable.class, Text.class, Text.class,
LongWritable.class);
SmartReducer<Text, LongWritable, Text, LongWritable> reducer = new ReducerWrapper<>(new WordCountReduce(), Text.class, LongWritable.class, Text.class,
LongWritable.class);
SmartMapper<LongWritable, Text, Text, LongWritable> mapper = new MapperWrapper<>(new WordCountMap(),
LongWritable.class, Text.class, Text.class, LongWritable.class);
SmartReducer<Text, LongWritable, Text, LongWritable> reducer = new ReducerWrapper<>(new WordCountReduce(),
Text.class, LongWritable.class, Text.class, LongWritable.class);
HadoopApprovals.verifyMapReduce(mapper, reducer, 0, "one fish two fish red fish blue fish");
}
public static class WordCountReduce extends MapReduceBase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.approvaltests.machine_specific_tests;

import com.spun.util.SystemUtils;

import java.util.Arrays;
import java.util.List;

import com.spun.util.SystemUtils;

public class MachineSpecific
{
public static boolean FORCE_RUN = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.approvaltests.machine_specific_tests;

import static org.junit.jupiter.api.Assumptions.assumeTrue;

import com.spun.util.SystemUtils;
import org.junit.jupiter.api.BeforeEach;

import com.spun.util.SystemUtils;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

public class MachineSpecificTest
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package org.approvaltests;

import java.awt.Dimension;
import java.awt.Rectangle;

import org.approvaltests.core.Options;
import org.approvaltests.reporters.ClipboardReporter;
import org.approvaltests.reporters.DiffReporter;
Expand All @@ -11,6 +8,8 @@
import org.junit.jupiter.api.Test;

import javax.swing.JButton;
import java.awt.Dimension;
import java.awt.Rectangle;

@UseReporter({DiffReporter.class, ClipboardReporter.class})
public class ApprovalsTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
import com.spun.util.io.FileUtils;
import com.spun.util.logger.SimpleLogger;
import org.approvaltests.core.Options;
import org.approvaltests.reporters.GenericDiffReporter;
import org.approvaltests.reporters.JunitReporter;
import org.approvaltests.reporters.intellij.IntelliJReporter;
import org.junit.jupiter.api.Test;
import org.junit.platform.commons.support.ModifierSupport;
import org.lambda.functions.Functions;
import org.lambda.query.Query;
import org.lambda.query.Queryable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package org.approvaltests;

import java.io.File;

import com.spun.util.io.FileUtils;
import org.approvaltests.reporters.DiffReporter;
import org.approvaltests.reporters.UseReporter;
import org.junit.jupiter.api.Test;

import com.spun.util.io.FileUtils;
import java.io.File;

@UseReporter(DiffReporter.class)
public class DirectoryOutputTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import javassist.CtClass;
import javassist.CtMethod;
import org.approvaltests.core.Options;
import org.approvaltests.reporters.QuietReporter;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.lambda.functions.Functions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
package org.approvaltests;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.File;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.List;

import com.spun.util.ArrayUtils;
import org.approvaltests.awt.AwtApprovals;
import org.approvaltests.combinations.CombinationApprovals;
import org.approvaltests.core.ApprovalFailureReporter;
Expand All @@ -18,12 +9,19 @@
import org.approvaltests.reporters.FirstWorkingReporter;
import org.approvaltests.reporters.UseReporter;
import org.approvaltests.reporters.UseReporterTest;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.lambda.query.Query;
import org.lambda.query.Queryable;

import com.spun.util.ArrayUtils;
import java.io.File;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class OptionsTest
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.approvaltests;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.approvaltests.core.ApprovalFailureReporter;
import org.approvaltests.reporters.QuietReporter;
import org.approvaltests.reporters.UseReporter;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

@UseReporter(QuietReporter.class)
public class ReportInjectionTest
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.approvaltests;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.approvaltests.PackageSettings.ApprovalTestsPackageLevelReporter;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class ReporterFactoryPackageLevelTest
{
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
package org.approvaltests;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.approvaltests.core.ApprovalFailureReporter;
import com.spun.util.ThreadUtils;
import org.approvaltests.reporters.ClipboardReporter;
import org.approvaltests.reporters.DiffReporter;
import org.approvaltests.reporters.EnvironmentAwareReporter;
import org.approvaltests.reporters.FirstWorkingReporter;
import org.approvaltests.reporters.UseReporter;
import org.junit.jupiter.api.Test;

import com.spun.util.ThreadUtils;

import java.lang.annotation.Annotation;
import static org.junit.jupiter.api.Assertions.assertEquals;

@UseReporter(ClipboardReporter.class)
public class ReporterFactoryTest
Expand Down Expand Up @@ -57,4 +53,4 @@ public static Class<? extends EnvironmentAwareReporter> getClassFor()
EnvironmentAwareReporter[] working = reporter.getReporters();
return working[1].getClass();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package org.approvaltests.approvers;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.File;
import java.io.IOException;

import com.spun.util.ObjectUtils;
import com.spun.util.io.FileUtils;
import com.spun.util.tests.StackTraceReflectionResult;
import com.spun.util.tests.TestUtils;
import org.approvaltests.Approvals;
import org.approvaltests.core.Options;
import org.approvaltests.core.VerifyResult;
Expand All @@ -15,10 +12,12 @@
import org.junit.jupiter.api.Test;
import org.lambda.functions.Function2;

import com.spun.util.ObjectUtils;
import com.spun.util.io.FileUtils;
import com.spun.util.tests.StackTraceReflectionResult;
import com.spun.util.tests.TestUtils;
import java.io.File;
import java.io.IOException;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class FileApproverTest
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.approvaltests.awt;

import java.time.Duration;

import com.spun.util.Tuple;
import org.approvaltests.core.Options;
import org.approvaltests.reporters.FileCaptureReporter;
import org.approvaltests.reporters.ImageWebReporter;
Expand All @@ -12,7 +11,7 @@
import org.junit.jupiter.api.condition.EnabledOnJre;
import org.junit.jupiter.api.condition.JRE;

import com.spun.util.Tuple;
import java.time.Duration;

//@UseReporter({FileCaptureReporter.class})
public class ApprovalsTest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.approvaltests.awt;

import java.util.Arrays;
import org.approvaltests.Approvals;
import org.junit.jupiter.api.Test;

import java.util.Arrays;

class GifSequenceWriterTest
{
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import com.spun.util.Colors;
import org.lambda.actions.Action0;

import java.awt.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

public class SquareDrawer implements Paintable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
package org.approvaltests.combinations;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;

import org.approvaltests.Approvals;
import org.approvaltests.combinations.pairwise.Case;
import org.approvaltests.combinations.pairwise.InParameterOrderStrategy;
import org.approvaltests.combinations.pairwise.OptionsForAParameter;
import org.approvaltests.combinations.pairwise.Pairwise;
import org.approvaltests.core.Options;
import org.approvaltests.legacycode.Range;
import org.approvaltests.reporters.FileLauncherReporter;
import org.approvaltests.reporters.UseReporter;
import org.approvaltests.reporters.macosx.BeyondCompareMacReporter;
import org.approvaltests.reporters.macosx.DiffMergeReporter;
import org.approvaltests.scrubbers.RegExScrubber;
import org.junit.jupiter.api.Test;
import org.lambda.actions.Action2;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;

@UseReporter(DiffMergeReporter.class)
public class PairWiseTest
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package org.approvaltests.combinations;

import com.spun.util.MapBuilder;
import org.approvaltests.Approvals;
import org.approvaltests.strings.Printable;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class PrintableTest
Expand Down
Loading

0 comments on commit 28e7351

Please sign in to comment.