Browse Source

Polishing

pull/1299/head
Juergen Hoeller 9 years ago
parent
commit
7f127300f9
  1. 12
      spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpSession.java
  2. 15
      spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpSubscription.java
  3. 13
      spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpUser.java

12
spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpSession.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,20 +19,23 @@ package org.springframework.messaging.simp.user; @@ -19,20 +19,23 @@ package org.springframework.messaging.simp.user;
import java.util.HashSet;
import java.util.Set;
/**
* @author Rossen Stoyanchev
*/
public class TestSimpSession implements SimpSession {
private String id;
private final String id;
private TestSimpUser user;
private Set<SimpSubscription> subscriptions = new HashSet<>();
private final Set<SimpSubscription> subscriptions = new HashSet<>();
public TestSimpSession(String id) {
this.id = id;
}
@Override
public String getId() {
return id;
@ -59,6 +62,7 @@ public class TestSimpSession implements SimpSession { @@ -59,6 +62,7 @@ public class TestSimpSession implements SimpSession {
}
}
@Override
public boolean equals(Object other) {
return (this == other || (other instanceof SimpSession && this.id.equals(((SimpSession) other).getId())));

15
spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpSubscription.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -13,18 +13,21 @@ @@ -13,18 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.messaging.simp.user;
package org.springframework.messaging.simp.user;
import org.springframework.util.ObjectUtils;
/**
* @author Rossen Stoyanchev
*/
public class TestSimpSubscription implements SimpSubscription {
private String id;
private final String destination;
private TestSimpSession session;
private final String id;
private String destination;
private TestSimpSession session;
public TestSimpSubscription(String id, String destination) {
@ -32,6 +35,7 @@ public class TestSimpSubscription implements SimpSubscription { @@ -32,6 +35,7 @@ public class TestSimpSubscription implements SimpSubscription {
this.id = id;
}
@Override
public String getId() {
return id;
@ -51,6 +55,7 @@ public class TestSimpSubscription implements SimpSubscription { @@ -51,6 +55,7 @@ public class TestSimpSubscription implements SimpSubscription {
return destination;
}
@Override
public boolean equals(Object other) {
if (this == other) {

13
spring-messaging/src/test/java/org/springframework/messaging/simp/user/TestSimpUser.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.messaging.simp.user;
import java.util.HashMap;
@ -20,18 +21,21 @@ import java.util.HashSet; @@ -20,18 +21,21 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* @author Rossen Stoyanchev
*/
public class TestSimpUser implements SimpUser {
private String name;
private final String name;
private Map<String, SimpSession> sessions = new HashMap<>();
private final Map<String, SimpSession> sessions = new HashMap<>();
public TestSimpUser(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
@ -59,6 +63,7 @@ public class TestSimpUser implements SimpUser { @@ -59,6 +63,7 @@ public class TestSimpUser implements SimpUser {
}
}
@Override
public boolean equals(Object other) {
return (this == other || (other instanceof SimpUser && this.name.equals(((SimpUser) other).getName())));

Loading…
Cancel
Save