Skip to content

Commit

Permalink
WICKET-7147: reversed order of parameters to null check methods. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jstuyts authored and bitstorm committed Feb 18, 2025
1 parent d718c41 commit a3a0888
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.List;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
import jakarta.servlet.http.HttpServletResponse;

import org.apache.wicket.Component;
import org.apache.wicket.MockPageParametersAware;
Expand All @@ -44,6 +43,7 @@
import org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler;
import org.apache.wicket.core.request.handler.IPageProvider;
import org.apache.wicket.core.request.handler.PageProvider;
import org.apache.wicket.core.util.tester.MockPageWithFormAndAjaxFormSubmitBehavior.Pojo;
import org.apache.wicket.core.util.tester.apps_1.Book;
import org.apache.wicket.core.util.tester.apps_1.CreateBook;
import org.apache.wicket.core.util.tester.apps_1.MyMockApplication;
Expand Down Expand Up @@ -81,12 +81,13 @@
import org.apache.wicket.util.tester.DummyHomePage;
import org.apache.wicket.util.tester.DummyHomePage.TestLink;
import org.apache.wicket.util.tester.FormTester;
import org.apache.wicket.core.util.tester.MockPageWithFormAndAjaxFormSubmitBehavior.Pojo;
import org.apache.wicket.util.tester.Result;
import org.apache.wicket.util.tester.WicketTestCase;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import jakarta.servlet.http.HttpServletResponse;

/**
* @see WicketTesterCookieTest for cookie related test
* @author Juergen Donnerstag
Expand All @@ -111,7 +112,7 @@ protected WebApplication newApplication()
}

/**
*
*
* @throws Exception
*/
@Test
Expand All @@ -128,7 +129,7 @@ void viewBook() throws Exception
}

/**
*
*
* @throws Exception
*/
@Test
Expand All @@ -150,7 +151,7 @@ void createBook_validateFail() throws Exception
}

/**
*
*
* @throws Exception
*/
@Test
Expand Down Expand Up @@ -238,7 +239,7 @@ void clickLink_ajaxLink_setResponsePageClass() throws Exception

/**
* WICKET-3164
*
*
* @throws Exception
*/
@Test
Expand All @@ -256,13 +257,13 @@ void clickLink_ajaxLink_notEnabled() throws Exception
}
catch (AssertionError ex)
{
;

}
}

/**
* WICKET-3164
*
*
* @throws Exception
*/
@Test
Expand All @@ -280,13 +281,13 @@ void executeAjaxEvent_componentNotEnabled() throws Exception
}
catch (AssertionError ex)
{
;

}
}

/**
* WICKET-3152
*
*
* @throws Exception
*/
@Test
Expand All @@ -304,13 +305,13 @@ void assertEnabled() throws Exception
}
catch (AssertionError ex)
{
;

}
}

/**
* WICKET-3152
*
*
* @throws Exception
*/
@Test
Expand All @@ -328,13 +329,13 @@ void assertDisabled() throws Exception
}
catch (AssertionError ex)
{
;

}
}

/**
* WICKET-3152
*
*
* @throws Exception
*/
@Test
Expand All @@ -357,7 +358,7 @@ void assertRequired() throws Exception
}
catch (AssertionError ex)
{
;

}

try
Expand All @@ -367,7 +368,7 @@ void assertRequired() throws Exception
}
catch (AssertionError ex)
{
;

}
}

Expand Down Expand Up @@ -449,7 +450,7 @@ void pageConstructor() throws Exception

/**
* Test instance constructor and inner page class
*
*
* @throws Exception
*/
@Test
Expand Down Expand Up @@ -692,7 +693,7 @@ void executeAjaxEvent_ajaxFormSubmitLink()
// executeAjaxEvent weren't submitting the form the name would have been
// reset to null, because the form would have been updated but there
// wouldn't be any data to update it with.
assertNotNull("executeAjaxEvent() did not properly submit the form", pojo.getName());
assertNotNull(pojo.getName(), "executeAjaxEvent() did not properly submit the form");
assertEquals("Mock name", pojo.getName());
}

Expand Down Expand Up @@ -973,7 +974,7 @@ void startResource()

/**
* <a href="https://issues.apache.org/jira/browse/WICKET-3716">WICKET-3716</a>
*
*
* @throws Exception
*/
@Test
Expand Down Expand Up @@ -1061,7 +1062,7 @@ public boolean isActionAuthorized(Component component, Action action)

/**
* https://issues.apache.org/jira/browse/WICKET-4437
*
*
* Clicking on ResourceLink should deliver the resource content
*/
@Test
Expand Down Expand Up @@ -1110,7 +1111,7 @@ public IResource getResource()

/**
* https://issues.apache.org/jira/browse/WICKET-4507
*
*
* When WicketTester#startComponentInPage() is used then #getLastResponseAsString() should
* return only the component's markup, without the autogenerated markup for the page
*/
Expand Down Expand Up @@ -1362,15 +1363,15 @@ void assertComponentInEnclosureInAjaxResponse()
@Test
void componentInPage() {
tester.startComponentInPage(Label.class);

tester.assertVisible("");

tester.startComponentInPage(new Label("otherLabel"));

tester.assertVisible("otherLabel");

tester.startComponentInPage(Label.class);

tester.assertVisible("");
}

Expand All @@ -1381,5 +1382,5 @@ public AlwaysRedirectPage()
// redirects to another web server on the same computer
throw new RedirectToUrlException("http://localhost:4333/");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class OriginResourceIsolationPolicy implements IResourceIsolationPolicy
*/
public OriginResourceIsolationPolicy addAcceptedOrigin(String acceptedOrigin)
{
Checks.notNull("acceptedOrigin", acceptedOrigin);
Checks.notNull(acceptedOrigin, "acceptedOrigin");

// strip any leading dot characters
final int len = acceptedOrigin.length();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2578,7 +2578,7 @@ public void component(final FormComponent<?> formComponent, final IVisit<Void> v
public String getContentTypeFromResponseHeader()
{
String contentType = getLastResponse().getContentType();
assertNotNull("No Content-Type header found", contentType);
assertNotNull(contentType, "No Content-Type header found");
return contentType;
}

Expand All @@ -2590,7 +2590,7 @@ public String getContentTypeFromResponseHeader()
public int getContentLengthFromResponseHeader()
{
String contentLength = getLastResponse().getHeader("Content-Length");
assertNotNull("No Content-Length header found", contentLength);
assertNotNull(contentLength, "No Content-Length header found");
return Integer.parseInt(contentLength);
}

Expand Down

0 comments on commit a3a0888

Please sign in to comment.