Skip to content

Commit

Permalink
🎨
Browse files Browse the repository at this point in the history
  • Loading branch information
TAKETODAY committed Nov 14, 2023
1 parent 9d99e4e commit 2bca770
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn
* Copyright © TODAY & 2017 - 2022 All Rights Reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER
* Copyright 2017 - 2023 the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -34,6 +31,7 @@
* @author Andy Wilkinson
* @author Eddú Meléndez
* @author Madhura Bhave
* @author <a href="https://github.com/TAKETODAY">Harry Yang</a>
* @since 4.0
*/
public class LocalHostUriTemplateHandler extends RootUriTemplateHandler {
Expand Down Expand Up @@ -77,8 +75,8 @@ public LocalHostUriTemplateHandler(Environment environment, String scheme) {
*/
public LocalHostUriTemplateHandler(Environment environment, String scheme, UriTemplateHandler handler) {
super(handler);
Assert.notNull(environment, "Environment must not be null");
Assert.notNull(scheme, "Scheme must not be null");
Assert.notNull(environment, "Environment is required");
Assert.notNull(scheme, "Scheme is required");
this.environment = environment;
this.scheme = scheme;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
* Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn
* Copyright © Harry Yang & 2017 - 2023 All Rights Reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER
* Copyright 2017 - 2023 the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -22,13 +19,13 @@

import org.junit.jupiter.api.Test;

import cn.taketoday.mock.env.MockEnvironment;
import cn.taketoday.web.util.UriTemplateHandler;

import java.net.URI;
import java.util.HashMap;
import java.util.Map;

import cn.taketoday.mock.env.MockEnvironment;
import cn.taketoday.web.util.UriTemplateHandler;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.BDDMockito.given;
Expand All @@ -47,21 +44,21 @@ class LocalHostUriTemplateHandlerTests {
@Test
void createWhenEnvironmentIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new LocalHostUriTemplateHandler(null))
.withMessageContaining("Environment must not be null");
.withMessageContaining("Environment is required");
}

@Test
void createWhenSchemeIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new LocalHostUriTemplateHandler(new MockEnvironment(), null))
.withMessageContaining("Scheme must not be null");
.withMessageContaining("Scheme is required");
}

@Test
void createWhenHandlerIsNullShouldThrowException() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new LocalHostUriTemplateHandler(new MockEnvironment(), "http", null))
.withMessageContaining("Handler must not be null");
.withMessageContaining("Handler is required");
}

@Test
Expand Down

0 comments on commit 2bca770

Please sign in to comment.