From 863941aa16a5e4a9eeee07ea843a81257e21a038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Thu, 16 Feb 2012 20:15:42 +0100 Subject: Rename ClientServiceImplTest => ClientTest. --- .../com/orbekk/same/ClientServiceImplTest.java | 37 ---------------------- same/src/test/java/com/orbekk/same/ClientTest.java | 37 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 37 deletions(-) delete mode 100644 same/src/test/java/com/orbekk/same/ClientServiceImplTest.java create mode 100644 same/src/test/java/com/orbekk/same/ClientTest.java (limited to 'same/src') diff --git a/same/src/test/java/com/orbekk/same/ClientServiceImplTest.java b/same/src/test/java/com/orbekk/same/ClientServiceImplTest.java deleted file mode 100644 index 4dfc54a..0000000 --- a/same/src/test/java/com/orbekk/same/ClientServiceImplTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.orbekk.same; - -import static org.junit.Assert.*; - -import org.junit.Test; -import static org.mockito.Mockito.*; - -public class ClientServiceImplTest { - private State state = new State("ClientNetwork"); - private TestConnectionManager connections = new TestConnectionManager(); - private Client client = new Client(state, connections, - "http://client/ClientService.json"); - private ClientService clientS = client.getService(); - - @Test public void testSetState() throws Exception { - clientS.setState("TestState", "Test data", 100); - assertEquals(100, state.getRevision("TestState")); - assertEquals("Test data", state.getDataOf("TestState")); - } - - @Test public void testNetworkListener() throws Exception { - NetworkNotificationListener listener = - mock(NetworkNotificationListener.class); - client.setNetworkListener(listener); - clientS.notifyNetwork("MyNetwork", "MasterUrl"); - verify(listener).notifyNetwork("MyNetwork", "MasterUrl"); - } - - @Test public void discover() throws Exception { - clientS.setState(".masterUrl", "master", 1); - ClientService mockClient = mock(ClientService.class); - connections.clientMap.put("mockClient/ClientService.json", - mockClient); - client.discover("mockClient/ClientService.json"); - verify(mockClient).notifyNetwork("ClientNetwork", "master"); - } -} diff --git a/same/src/test/java/com/orbekk/same/ClientTest.java b/same/src/test/java/com/orbekk/same/ClientTest.java new file mode 100644 index 0000000..a4671d4 --- /dev/null +++ b/same/src/test/java/com/orbekk/same/ClientTest.java @@ -0,0 +1,37 @@ +package com.orbekk.same; + +import static org.junit.Assert.*; + +import org.junit.Test; +import static org.mockito.Mockito.*; + +public class ClientTest { + private State state = new State("ClientNetwork"); + private TestConnectionManager connections = new TestConnectionManager(); + private Client client = new Client(state, connections, + "http://client/ClientService.json"); + private ClientService clientS = client.getService(); + + @Test public void testSetState() throws Exception { + clientS.setState("TestState", "Test data", 100); + assertEquals(100, state.getRevision("TestState")); + assertEquals("Test data", state.getDataOf("TestState")); + } + + @Test public void testNetworkListener() throws Exception { + NetworkNotificationListener listener = + mock(NetworkNotificationListener.class); + client.setNetworkListener(listener); + clientS.notifyNetwork("MyNetwork", "MasterUrl"); + verify(listener).notifyNetwork("MyNetwork", "MasterUrl"); + } + + @Test public void discover() throws Exception { + clientS.setState(".masterUrl", "master", 1); + ClientService mockClient = mock(ClientService.class); + connections.clientMap.put("mockClient/ClientService.json", + mockClient); + client.discover("mockClient/ClientService.json"); + verify(mockClient).notifyNetwork("ClientNetwork", "master"); + } +} -- cgit v1.2.3