Skip to content

Commit

Permalink
issue #467: correct UT
Browse files Browse the repository at this point in the history
  • Loading branch information
bhecquet committed Dec 6, 2021
1 parent a44d6e7 commit ca12257
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ public class FieldDetectorConnector {
private static final String DETECT_ERROR_URL = "/detectError";
private static FieldDetectorConnector fieldDetectorConnector;


/**
* For test only
* @param fieldDetectorConnector
*/
public static void resetFieldDetectorConnector() {
FieldDetectorConnector.fieldDetectorConnector = null;
}

public static FieldDetectorConnector getInstance(String url) {
if (fieldDetectorConnector == null) {
fieldDetectorConnector = new FieldDetectorConnector(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import org.powermock.core.classloader.annotations.PrepareForTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import com.seleniumtests.ConnectorsTest;
Expand All @@ -23,6 +24,10 @@
@PrepareForTest({ Unirest.class })
public class TestFieldDetectorConnector extends ConnectorsTest {

@BeforeMethod(alwaysRun = true)
public void init() {
FieldDetectorConnector.resetFieldDetectorConnector();
}

@Test(groups = { "ut" })
public void testIsAlive() {
Expand Down

0 comments on commit ca12257

Please sign in to comment.