only:junit5

This commit is contained in:
rusefillc 2023-12-15 11:35:33 -05:00
parent c2b1ba7e01
commit e65508bcd4
39 changed files with 72 additions and 74 deletions

View File

@ -27,11 +27,9 @@ dependencies {
implementation global_libs.json
implementation ts_plugin_libs.httpclient
// junit 4.13 does not mix well with httpclient :(
testImplementation group: 'junit', name: 'junit', version: '4.8.2'
testFixturesImplementation global_libs.mockito
testFixturesApi global_libs.annotations
testFixturesApi global_libs.junit
testFixturesApi global_libs.junit5api
}
tasks.register('copyJniHeader', Copy) {
@ -43,4 +41,4 @@ tasks.register('copyJniHeader', Copy) {
test {
dependsOn("copyJniHeader")
}
}

View File

@ -2,7 +2,7 @@ package com.rusefi;
import com.rusefi.core.RusEfiSignature;
import com.rusefi.core.SignatureHelper;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;

View File

@ -1,7 +1,7 @@
package com.rusefi.binaryprotocol.test;
import com.rusefi.binaryprotocol.IoHelper;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.Arrays;

View File

@ -1,7 +1,7 @@
package com.rusefi.binaryprotocol.test;
import com.rusefi.binaryprotocol.IoHelper;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;

View File

@ -2,7 +2,7 @@ package com.rusefi.io.can;
import com.rusefi.io.can.elm.Elm327Connector;
import com.rusefi.util.HexBinary;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;

View File

@ -1,9 +1,9 @@
package com.rusefi.io.can;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class HexUtilTest {
@Test
@ -25,9 +25,10 @@ public class HexUtilTest {
assertArrayEquals(new byte[]{0, 0, 1, (byte) 0xab, (byte) 0xcd, 0, 0}, destination);
}
@Test(expected = NumberFormatException.class)
@Test
public void unexpected() {
HexUtil.hexToBytes("0xff");
assertThrows(NumberFormatException.class, () -> {
HexUtil.hexToBytes("0xff");});
}
@Test

View File

@ -3,7 +3,7 @@ package com.rusefi.io.can;
import com.rusefi.config.generated.Fields;
import com.rusefi.io.can.isotp.IsoTpConnector;
import com.rusefi.util.HexBinary;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,7 +1,7 @@
package com.rusefi.io.serial;
import com.rusefi.Timeouts;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;

View File

@ -4,7 +4,7 @@ import com.rusefi.config.generated.FuelComputer;
import com.rusefi.config.generated.IgnitionState;
import com.rusefi.config.generated.TsOutputs;
import com.rusefi.enums.live_data_e;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;

View File

@ -2,7 +2,7 @@ package com.rusefi.test;
import com.opensr5.ConfigurationImage;
import com.rusefi.core.Pair;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static com.rusefi.ConfigurationImageDiff.findDifferences;
import static org.junit.Assert.assertEquals;

View File

@ -5,7 +5,7 @@ import com.rusefi.binaryprotocol.IoHelper;
import com.rusefi.config.generated.Fields;
import com.rusefi.io.commands.GetOutputsCommand;
//import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

View File

@ -1,6 +1,6 @@
package com.rusefi.uds;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;

View File

@ -19,6 +19,7 @@ import com.rusefi.server.rusEFISSLContext;
import com.rusefi.core.FileUtil;
import com.rusefi.tune.xml.Constant;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Assertions;
import java.io.IOException;
import java.net.Socket;
@ -31,8 +32,6 @@ import static com.rusefi.Timeouts.READ_IMAGE_TIMEOUT;
import static com.rusefi.config.generated.Fields.TS_FILE_VERSION;
import static com.rusefi.config.generated.Fields.TS_FILE_VERSION_OFFSET;
import static com.rusefi.io.tcp.TcpConnector.LOCALHOST;
import org.junit.Assert;
import static org.junit.Assert.assertTrue;
public class TestHelper extends MockitoTestHelper {
private static final Logging log = getLogging(TestHelper.class);
@ -115,13 +114,13 @@ public class TestHelper extends MockitoTestHelper {
}
public static void assertLatch(String message, CountDownLatch reconnectCounter, int timeout) throws InterruptedException {
Assert.assertTrue(message, reconnectCounter.await(timeout, TimeUnit.MILLISECONDS));
Assertions.assertTrue(reconnectCounter.await(timeout, TimeUnit.MILLISECONDS), message);
log.info("*******************");
log.info(message + " is good");
log.info("*******************");
}
public static void assertLatch(CountDownLatch reconnectCounter) throws InterruptedException {
Assert.assertTrue(reconnectCounter.await(READ_IMAGE_TIMEOUT, TimeUnit.MILLISECONDS));
Assertions.assertTrue(reconnectCounter.await(READ_IMAGE_TIMEOUT, TimeUnit.MILLISECONDS));
}
}

View File

@ -6,9 +6,10 @@ import com.opensr5.ini.field.ScalarIniField;
import com.rusefi.config.FieldType;
import com.rusefi.config.generated.Fields;
import com.rusefi.tune.xml.Constant;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertEquals;
public class TuneWriterTest {
@Test

View File

@ -3,7 +3,7 @@ package com.rusefi.autotune.test;
import com.rusefi.autotune.FuelAutoTune2;
import com.rusefi.autotune.Result;
import com.rusefi.autotune.AfrDataPoint;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;

View File

@ -2,12 +2,12 @@ package com.rusefi.autotune.test;
import com.rusefi.autotune.*;
import com.rusefi.config.generated.Fields;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* 1/5/2016

View File

@ -3,7 +3,7 @@ package com.rusefi.composite.test;
import com.rusefi.stream.VcdStreamFile;
import com.rusefi.composite.CompositeEvent;
import com.rusefi.composite.CompositeParser;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.StringWriter;

View File

@ -5,9 +5,9 @@ import com.rusefi.config.Field;
import com.rusefi.config.FieldCommandResponse;
import com.rusefi.config.generated.Fields;
import com.rusefi.core.Pair;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;
public class FieldTest {
@Test

View File

@ -1,10 +1,9 @@
package com.rusefi.core.test;
import com.rusefi.core.EngineState;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
/**
* @author Andrey Belomutskiy

View File

@ -2,11 +2,11 @@ package com.rusefi.core.test;
import com.rusefi.core.ResponseBuffer;
import com.rusefi.io.LinkDecoder;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.concurrent.atomic.AtomicReference;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;
/**
* @author Andrey Belomutskiy

View File

@ -1,11 +1,11 @@
package com.rusefi.stream;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class LogicdataStreamFileTest {
@Test

View File

@ -1,15 +1,17 @@
package com.rusefi.test;
import com.rusefi.BinarySearch;
import junit.framework.TestCase;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import static org.junit.jupiter.api.Assertions.*;
public class BinarySearchTest extends TestCase {
public class BinarySearchTest {
public static void main(String[] args) {
new BinarySearchTest().testBinary();
}
@Test
public void testBinary() {
double[] angles = new double[] {0, 56, 126, 180, 236, 279, 306, 416, 486, 540, 596, 666};
@ -29,4 +31,4 @@ public class BinarySearchTest extends TestCase {
assertEquals(11, BinarySearch.binarySearch(700, angles));
}
}
}

View File

@ -2,9 +2,9 @@ package com.rusefi.test;
import com.rusefi.CyclicBuffer;
import com.rusefi.DataBuffer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static junit.framework.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.*;
public class CyclicBufferTest {
@Test
@ -22,4 +22,4 @@ public class CyclicBufferTest {
assertEquals(147.1144679039647, DataBuffer.getStandardDeviation(cb.getValues()));
}
}
}

View File

@ -2,13 +2,12 @@ package com.rusefi.test;
import com.rusefi.DataBuffer;
import com.rusefi.TimeBasedBuffer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicLong;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
public class TimeBasedBufferTest {
@Test

View File

@ -2,9 +2,9 @@ package com.rusefi.tracing.test;
import com.rusefi.tracing.Entry;
import com.rusefi.tracing.Phase;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class EntryTest {
@Test

View File

@ -3,14 +3,14 @@ package com.rusefi.tracing.test;
import com.rusefi.tracing.Entry;
import com.rusefi.tracing.JsonOutput;
import com.rusefi.tracing.Phase;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class PerfJsonOutputTest {
@Test

View File

@ -1,10 +1,9 @@
package com.rusefi.ui.test;
import com.rusefi.auth.AuthTokenUtil;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
public class AuthTokenUtilTest {
@Test

View File

@ -5,12 +5,12 @@ import com.rusefi.waves.EngineChart;
import com.rusefi.waves.EngineReport;
import com.rusefi.waves.RevolutionLog;
import com.rusefi.waves.EngineChartParser;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.List;
import static com.rusefi.waves.EngineReport.isCloseEnough;
import static junit.framework.Assert.*;
import static org.junit.jupiter.api.Assertions.*;
/**
* 1/26/14
@ -53,7 +53,7 @@ public class EngineChartParserTest {
for (EngineReport.UpDown ud : wr.getList()) {
assertTrue(isCloseEnough(238.75, rl.getCrankAngleByTime(ud.upTime)));
assertTrue(ud.getDutyCycle(rl) + "", isCloseEnough(0.0307, ud.getDutyCycle(rl)));
assertTrue(isCloseEnough(0.0307, ud.getDutyCycle(rl)), ud.getDutyCycle(rl) + "");
}
}

View File

@ -1,9 +1,9 @@
package com.rusefi.waves.test;
import com.rusefi.waves.EngineReport;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static junit.framework.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.*;
/**
* Date: 6/23/13

View File

@ -1,8 +1,8 @@
package com.rusefi.waves.test;
import com.rusefi.waves.RevolutionLog;
import junit.framework.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* Andrey Belomutskiy (c) 2012-2014
@ -13,9 +13,9 @@ public class RevolutionLogTest {
public void backTime() {
RevolutionLog r = RevolutionLog.parseRevolutions("2000!148958!2000!154958!2000!160958!2000!166958!");
Assert.assertEquals(594.84, r.getCrankAngleByTime(147915));
assertEquals(594.84, r.getCrankAngleByTime(147915));
// too back into the past
Assert.assertEquals(Double.NaN, r.getCrankAngleByTime(140915));
assertEquals(Double.NaN, r.getCrankAngleByTime(140915));
}
}

View File

@ -9,7 +9,7 @@ import com.rusefi.io.tcp.BinaryProtocolProxy;
import com.rusefi.io.tcp.BinaryProtocolServer;
import com.rusefi.io.tcp.TcpConnector;
import com.rusefi.ui.StatusConsumer;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Objects;

View File

@ -1,7 +1,7 @@
package com.rusefi.test;
import com.rusefi.Histograms;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.Random;

View File

@ -2,7 +2,7 @@ package com.rusefi.test;
//import com.rusefi.ui.widgets.PotCommand;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.jupiter.api.Test;
public class VoltageDividerTest extends TestCase {
@ -12,4 +12,4 @@ public class VoltageDividerTest extends TestCase {
//
// assertEquals(2040.816326530612, PotCommand.getR1InVoltageDivider3(1, 4.9, 10000));
}
}
}

View File

@ -1,7 +1,7 @@
package com.rusefi.ui;
import neoe.formatter.lua.LuaFormatter;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;

View File

@ -8,7 +8,7 @@ import com.rusefi.livedata.LiveDataParserSandbox;
import com.rusefi.livedata.ParseResult;
import org.antlr.v4.runtime.tree.ParseTree;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.net.URISyntaxException;
@ -17,7 +17,7 @@ import java.util.TreeMap;
import static com.rusefi.CodeWalkthrough.TRUE_CONDITION;
import static com.rusefi.ui.LiveDataPane.CPP_SUFFIX;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;

View File

@ -1,7 +1,7 @@
package com.rusefi.ui.livedata;
import com.rusefi.livedata.LiveDataParserPanel;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.*;
import java.net.URISyntaxException;

View File

@ -1,6 +1,6 @@
package com.rusefi.ui.lua;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;

View File

@ -3,7 +3,7 @@ package com.rusefi.ui.test;
import com.rusefi.config.generated.Fields;
import com.rusefi.ui.engine.EngineSnifferPanel;
import com.rusefi.ui.engine.NameUtil;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.Set;
import java.util.TreeSet;

View File

@ -2,7 +2,7 @@ package com.rusefi.ui.test;
import com.rusefi.ui.RpmModel;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Date: 12/27/12