Skip to content

Commit

Permalink
unit test one step closer #16
Browse files Browse the repository at this point in the history
  • Loading branch information
GavriYashar committed Oct 2, 2017
1 parent 8bacb60 commit e955a59
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 3 deletions.
37 changes: 34 additions & 3 deletions src/at/mep/utiltest/UtilTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
package at.mep.utiltest;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/** Created by Gavri on 2017-05-16. */
public class UtilTest {

public void setUpEnvironMent() {

public static void setUpEnvironMent() {
try {
startMatlab();
} catch (IOException e) {
e.printStackTrace();
}
}

private void setUpFileStructureEnvironment() {
private static void startMatlab() throws IOException {
/*
https://stackoverflow.com/questions/14596599/run-command-prompt-as-administrator
https://stackoverflow.com/questions/16316950/java-junit-how-to-test-if-an-external-program-process-application-is-running
*/

String exe = "G:\\Program Files\\MATLAB\\R2016b\\bin\\matlab.exe";

// nothing happens
String startUpCmd = "-r fprintf('test')";

// still nothing
String startMEP = "at.mep.Start.start('F:\\Coding\\IntelliJ\\matlab-editor-plugin\\out\\artifacts\\MEP_1_14\\CustomProps.properties', 'F:\\Coding\\IntelliJ\\matlab-editor-plugin\\out\\artifacts\\MEP_1_14\\DefaultProps.properties')";

// works... at least *yay*
String jdb = "-jdb";

List<String> command = new ArrayList<>(5);
command.add(exe);
command.add(jdb);
Process process = new ProcessBuilder(command).start();
}
}
10 changes: 10 additions & 0 deletions startup.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
% at.mep.Start.start(...
% 'F:\Coding\IntelliJ\matlab-editor-plugin\out\artifacts\MEP_1_14\CustomProps.properties', ...
% 'F:\Coding\IntelliJ\matlab-editor-plugin\out\artifacts\MEP_1_14\DefaultProps.properties');

fprintf('\nUNIT-TEST: wrong startup')
fprintf('\nHOME > Preferences > MATLAB > General > Initial working folder > SPECIFY FOLDER WHERE STARTUP IS LOCATED')
fprintf('\n')
fprintf('\nmake sure that javaclasspath is set correctly')
fprintf('\nedit javaclasspath.txt')
fprintf('\nwinopen(prefdir)')
23 changes: 23 additions & 0 deletions tests/at/mep/utiltest/UtilTestTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package at.mep.utiltest;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

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

class UtilTestTest {
@BeforeEach
void setUp() {
}

@AfterEach
void tearDown() {
}

@Test
void startMatlab() {
UtilTest.setUpEnvironMent();
}

}

0 comments on commit e955a59

Please sign in to comment.