Skip to content
Snippets Groups Projects
Commit eea8248a authored by cramakri's avatar cramakri
Browse files

LMS-1342 Refactoring of tests so as not to cause warnings when running system tests.

SVN: 14388
parent 06de6e0e
No related branches found
No related tags found
No related merge requests found
......@@ -131,6 +131,14 @@ public final class UrlParamsHelper
setUrlParams(parseParamString(nonEmptyParameterString));
}
/**
* A public version of initializeUrlParamters used by a test case
*/
public final void initializeUrlParametersForTest(String nonEmptyParameterString)
{
initializeUrlParameters(nonEmptyParameterString);
}
public final IDelegatedAction getOpenInitialTabAction()
{
return new OpenInitialTabAction();
......@@ -138,9 +146,9 @@ public final class UrlParamsHelper
/**
* An action that opens the initial tab specified by the URL parameters. This class is given
* package visibility so it can be used by a test.
* public visibility so it can be used by a test.
*/
class OpenInitialTabAction implements IDelegatedAction
public class OpenInitialTabAction implements IDelegatedAction
{
public void execute()
......@@ -164,10 +172,9 @@ public final class UrlParamsHelper
}
/**
* Opens an initial tab if a parameter is specified in URL. Given package visibility so it
* can be used by a test.
* Opens an initial tab if a parameter is specified in URL.
*/
void openInitialTabUnderExceptionHandler() throws UserFailureException
private void openInitialTabUnderExceptionHandler() throws UserFailureException
{
// If a permlink has been specified, open a viewer on the specified object
String entityKindValueOrNull =
......@@ -191,6 +198,14 @@ public final class UrlParamsHelper
}
}
/**
* A public version of openInitialTabUnderExceptionHandler() used by the test case.
*/
public void openInitialTabUnderExceptionHandlerForTest() throws UserFailureException
{
openInitialTabUnderExceptionHandler();
}
/**
* Open the entity details tab for the specified entity kind and permId.
*/
......
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.generic.client.web.client.application;
package ch.systemsx.cisd.openbis.generic.client.web.clientnonjs;
import org.jmock.Expectations;
import org.jmock.Mockery;
......@@ -24,6 +24,9 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import ch.systemsx.cisd.openbis.generic.client.web.client.ICommonClientServiceAsync;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.UrlParamsHelper;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.UrlParamsHelper.OpenInitialTabAction;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.ListSampleDisplayCriteria;
......@@ -76,7 +79,7 @@ public class UrlParamsHelperTest extends AssertJUnit
});
final UrlParamsHelper urlParamsHelper = new UrlParamsHelper(viewContext);
urlParamsHelper.initializeUrlParameters("entity=SAMPLE&permId=20100104150239401-871");
urlParamsHelper.initializeUrlParametersForTest("entity=SAMPLE&permId=20100104150239401-871");
IDelegatedAction action = urlParamsHelper.getOpenInitialTabAction();
action.execute();
......@@ -102,12 +105,12 @@ public class UrlParamsHelperTest extends AssertJUnit
// No permId supplied
urlParamsHelper = new UrlParamsHelper(viewContext);
urlParamsHelper.initializeUrlParameters("entity=SAMPLE");
urlParamsHelper.initializeUrlParametersForTest("entity=SAMPLE");
action = (OpenInitialTabAction) urlParamsHelper.getOpenInitialTabAction();
try
{
action.openInitialTabUnderExceptionHandler();
action.openInitialTabUnderExceptionHandlerForTest();
fail("A URL with no permId should result in an exception.");
} catch (UserFailureException expected)
{
......@@ -116,12 +119,12 @@ public class UrlParamsHelperTest extends AssertJUnit
// No entity supplied
urlParamsHelper = new UrlParamsHelper(viewContext);
urlParamsHelper.initializeUrlParameters("permId=20100104150239401-871");
urlParamsHelper.initializeUrlParametersForTest("permId=20100104150239401-871");
action = (OpenInitialTabAction) urlParamsHelper.getOpenInitialTabAction();
try
{
action.openInitialTabUnderExceptionHandler();
action.openInitialTabUnderExceptionHandlerForTest();
fail("A URL with no entity should result in an exception.");
} catch (UserFailureException expected)
{
......@@ -147,12 +150,12 @@ public class UrlParamsHelperTest extends AssertJUnit
UrlParamsHelper.OpenInitialTabAction action;
urlParamsHelper = new UrlParamsHelper(viewContext);
urlParamsHelper.initializeUrlParameters("entity=JUNK");
urlParamsHelper.initializeUrlParametersForTest("entity=JUNK");
action = (OpenInitialTabAction) urlParamsHelper.getOpenInitialTabAction();
try
{
action.openInitialTabUnderExceptionHandler();
action.openInitialTabUnderExceptionHandlerForTest();
fail("A URL with invalid entity should result in an exception.");
} catch (UserFailureException expected)
{
......@@ -180,7 +183,7 @@ public class UrlParamsHelperTest extends AssertJUnit
});
final UrlParamsHelper urlParamsHelper = new UrlParamsHelper(viewContext);
urlParamsHelper.initializeUrlParameters("searchEntity=SAMPLE&code=CL1");
urlParamsHelper.initializeUrlParametersForTest("searchEntity=SAMPLE&code=CL1");
IDelegatedAction action = urlParamsHelper.getOpenInitialTabAction();
action.execute();
......@@ -206,7 +209,7 @@ public class UrlParamsHelperTest extends AssertJUnit
});
final UrlParamsHelper urlParamsHelper = new UrlParamsHelper(viewContext);
urlParamsHelper.initializeUrlParameters("searchEntity=SAMPLE");
urlParamsHelper.initializeUrlParametersForTest("searchEntity=SAMPLE");
IDelegatedAction action = urlParamsHelper.getOpenInitialTabAction();
action.execute();
......@@ -227,14 +230,14 @@ public class UrlParamsHelperTest extends AssertJUnit
});
final UrlParamsHelper urlParamsHelper = new UrlParamsHelper(viewContext);
urlParamsHelper.initializeUrlParameters("searchEntity=DATA_SET");
urlParamsHelper.initializeUrlParametersForTest("searchEntity=DATA_SET");
OpenInitialTabAction action =
(OpenInitialTabAction) urlParamsHelper.getOpenInitialTabAction();
try
{
action.openInitialTabUnderExceptionHandler();
action.openInitialTabUnderExceptionHandlerForTest();
fail("Only SAMPLE is supported by the search link mechanism right now.");
} catch (UserFailureException expected)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment