mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-17 02:59:23 +00:00
Added Comments and Feedback
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.iluwatar.monostate;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
public void testSameStateAmonstAllInstances() {
|
||||
LoadBalancer balancer = new LoadBalancer();
|
||||
LoadBalancer balancer2 = new LoadBalancer();
|
||||
balancer.addServer(new Server("localhost", 8085, 6));
|
||||
// Both should have the same number of servers.
|
||||
Assert.assertTrue(balancer.getNoOfServers() == balancer2.getNoOfServers());
|
||||
// Both Should have the same LastServedId
|
||||
Assert.assertTrue(balancer.getLastServedId() == balancer2.getLastServedId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMain() {
|
||||
String[] args = {};
|
||||
App.main(args);
|
||||
Assert.assertTrue(LoadBalancer.getLastServedId() == 2);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user