helping build
This commit is contained in:
parent
4c0a05152d
commit
3d090937b5
|
@ -15,5 +15,6 @@
|
|||
<orderEntry type="module" module-name="models" exported="" />
|
||||
<orderEntry type="library" exported="" name="annotations" level="project" />
|
||||
<orderEntry type="module" module-name="inifile" exported="" />
|
||||
<orderEntry type="library" scope="TEST" name="org.mockito:mockito-all:1.10.19" level="project" />
|
||||
</component>
|
||||
</module>
|
|
@ -16,6 +16,7 @@ import com.rusefi.server.SessionDetails;
|
|||
import com.rusefi.server.rusEFISSLContext;
|
||||
import com.rusefi.tune.xml.Constant;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
|
@ -32,6 +33,9 @@ public class TestHelper {
|
|||
public static final ControllerInfo CONTROLLER_INFO = new ControllerInfo("name", "make", "code", Fields.TS_SIGNATURE);
|
||||
public static final String TEST_TOKEN_1 = "00000000-1234-1234-1234-123456789012";
|
||||
public static final String TEST_TOKEN_3 = "33333333-3333-1234-1234-123456789012";
|
||||
public static final Answer<?> NEGATIVE_ANSWER = invocation -> {
|
||||
throw new UnsupportedOperationException("Not mocked " + invocation);
|
||||
};
|
||||
|
||||
@NotNull
|
||||
public static ScalarIniField createIniField(Field field) {
|
||||
|
|
|
@ -5,10 +5,8 @@ import com.rusefi.TsTuneReader;
|
|||
import com.rusefi.autoupdate.AutoupdateUtil;
|
||||
import com.rusefi.tools.online.Online;
|
||||
import com.rusefi.tools.online.UploadResult;
|
||||
import com.rusefi.ui.util.FrameHelper;
|
||||
import org.apache.http.concurrent.FutureCallback;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.putgemin.VerticalFlowLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -18,27 +16,14 @@ import java.io.File;
|
|||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
public class LogUploadSelector {
|
||||
private final JPanel content = new JPanel(new BorderLayout());
|
||||
private final JLabel uploadState = new JLabel();
|
||||
|
||||
private final JPanel fileList = new JPanel(new VerticalFlowLayout());
|
||||
|
||||
public static final Answer<?> NEGATIVE_ANSWER = invocation -> {
|
||||
throw new UnsupportedOperationException("Not mocked " + invocation);
|
||||
};
|
||||
private final Supplier<ControllerAccess> controllerAccessSupplier;
|
||||
|
||||
public static void main(String[] args) {
|
||||
String projectName = "mre_f4";
|
||||
ControllerAccess controllerAccess = mock(ControllerAccess.class, NEGATIVE_ANSWER);
|
||||
doReturn(new String[]{projectName}).when(controllerAccess).getEcuConfigurationNames();
|
||||
|
||||
new FrameHelper().showFrame(new LogUploadSelector(() -> controllerAccess).getContent());
|
||||
}
|
||||
|
||||
public LogUploadSelector(Supplier<ControllerAccess> controllerAccessSupplier) {
|
||||
this.controllerAccessSupplier = controllerAccessSupplier;
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.rusefi.ts_plugin;
|
||||
|
||||
import com.efiAnalytics.plugin.ecu.ControllerAccess;
|
||||
import com.rusefi.TestHelper;
|
||||
import com.rusefi.ui.util.FrameHelper;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class LogUploadSelectorSandbox {
|
||||
public static void main(String[] args) {
|
||||
String projectName = "mre_f4";
|
||||
ControllerAccess controllerAccess = mock(ControllerAccess.class, TestHelper.NEGATIVE_ANSWER);
|
||||
doReturn(new String[]{projectName}).when(controllerAccess).getEcuConfigurationNames();
|
||||
|
||||
new FrameHelper().showFrame(new LogUploadSelector(() -> controllerAccess).getContent());
|
||||
}
|
||||
|
||||
}
|
|
@ -10,7 +10,7 @@ import com.rusefi.ui.util.FrameHelper;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.rusefi.ts_plugin.LogUploadSelector.NEGATIVE_ANSWER;
|
||||
import static com.rusefi.TestHelper.NEGATIVE_ANSWER;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
|
|
Loading…
Reference in New Issue