Commit 7ef876f3 authored by Feng Xue's avatar Feng Xue

Fix the little bug of filter tests

Fix the bug of missing study warning messages in correlation and
regression filters' tests
Fixes #2102
parent 8f0aecff
package com.nesstar.rest.filters;
import com.nesstar.api.Study;
import com.nesstar.api.Variable;
import com.nesstar.rest.common.ETag;
import com.nesstar.rest.common.ServerHandler;
......@@ -21,7 +22,7 @@ public class CorrelationEntityTagFilterTest extends EntityTagFilterTest {
public void testSimpleCorrelation() throws Exception {
when(request.getRequestURL()).thenReturn(new StringBuffer("http://example.com/study/study1234/correlate?corrVar=var1&corrVar=var2"));
when(request.getRequestURI()).thenReturn("/study/study1234/correlate");
when(request.getHeader("If-None-Match")).thenReturn("b3887a8322bf988fb29fc758480212bd");
when(request.getHeader("If-None-Match")).thenReturn("7f1c4f517bf0eea0229b97a087c7a2a7");
Variable var1 = mock(Variable.class);
Variable var2 = mock(Variable.class);
......@@ -43,7 +44,7 @@ public class CorrelationEntityTagFilterTest extends EntityTagFilterTest {
public void testComplexCorrelation() throws Exception {
when(request.getRequestURL()).thenReturn(new StringBuffer("http://example.com/study/study1234/correlate?corrVar=var1&corrVar=var2&wgtVar=var11&caseSubset=ID(%27var1%27)%3CID(%27category_0_0%27)"));
when(request.getRequestURI()).thenReturn("/study/study1234/correlate");
when(request.getHeader("If-None-Match")).thenReturn("f66e0cd97dec4b3098ffe651581f5723");
when(request.getHeader("If-None-Match")).thenReturn("1a0c22dbc4eb4b76d7dc8d143d153b00");
when(request.getParameterValues("wgtVar")).thenReturn(new String[] { "var11" });
when(request.getParameter("caseSubset")).thenReturn("foo<bar");
......@@ -75,6 +76,12 @@ public class CorrelationEntityTagFilterTest extends EntityTagFilterTest {
public void setUp() throws Exception {
commonSetUp();
Study study = mock(Study.class);
when(study.getId()).thenReturn("study1234");
when(study.getTimeStamp()).thenReturn(createDate());
when(bank.get("study1234")).thenReturn(study);
}
}
package com.nesstar.rest.filters;
import com.nesstar.api.Study;
import com.nesstar.api.Variable;
import com.nesstar.rest.common.ETag;
import com.nesstar.rest.common.ServerHandler;
......@@ -21,7 +22,7 @@ public class RegressionEntityTagFilterTest extends EntityTagFilterTest{
public void testSimpleRegression() throws Exception {
when(request.getRequestURL()).thenReturn(new StringBuffer("http://example.com/study/study1234/regress?depVar=var1&indVar=var2"));
when(request.getRequestURI()).thenReturn("/study/study1234/regress");
when(request.getHeader("If-None-Match")).thenReturn("9bdaca607b671ec92842a6b4697a9598");
when(request.getHeader("If-None-Match")).thenReturn("2517cb7e730e782e0c549f214d65ea82");
Variable var1 = mock(Variable.class);
Variable var2 = mock(Variable.class);
......@@ -43,7 +44,7 @@ public class RegressionEntityTagFilterTest extends EntityTagFilterTest{
public void testComplexRegression() throws Exception {
when(request.getRequestURL()).thenReturn(new StringBuffer("http://example.com/study/study1234/regress?depVar=var1&indVar=var2&wgtVar=var11&caseSubset=ID(%27var1%27)%3CID(%27category_0_0%27)"));
when(request.getRequestURI()).thenReturn("/study/study1234/regress");
when(request.getHeader("If-None-Match")).thenReturn("24261e5487ac3e5870aeb2363ca9fa16");
when(request.getHeader("If-None-Match")).thenReturn("d88166e676709082e72b4c4491250d95");
when(request.getParameterValues("wgtVar")).thenReturn(new String[] { "var11" });
when(request.getParameter("caseSubset")).thenReturn("foo<bar");
......@@ -74,6 +75,12 @@ public class RegressionEntityTagFilterTest extends EntityTagFilterTest{
@Before
public void setUp() throws Exception {
commonSetUp();
Study study = mock(Study.class);
when(study.getId()).thenReturn("study1234");
when(study.getTimeStamp()).thenReturn(createDate());
when(bank.get("study1234")).thenReturn(study);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment