| package de.pta.mics.home.controller; |
| |
| import de.pta.mics.home.common.HttpStatusException; |
| import de.pta.mics.home.communication.RestServiceWrapper; |
| import org.easymock.EasyMock; |
| import org.junit.Test; |
| import org.powermock.reflect.Whitebox; |
| |
| import static org.easymock.EasyMock.anyString; |
| import static org.junit.Assert.assertEquals; |
| |
| public class CentralProxyTest { |
| |
| @Test |
| public void testAll() throws HttpStatusException { |
| RestServiceWrapper rsw = EasyMock.createMock(RestServiceWrapper.class); |
| EasyMock.expect(rsw.performGetRequest(anyString())).andReturn("fine").anyTimes(); |
| EasyMock.replay(rsw); |
| EasyMock.verify(rsw); |
| CentralProxy cp = new CentralProxy("TEST_URL"); |
| |
| Whitebox.setInternalState(cp, "restServiceWrapper", rsw); |
| |
| assertEquals( "fine", cp.getHealthState("/abs", |
| "https", "123.456.789.0", "4711")); |
| assertEquals( "fine", cp.getServerDistribution("klausDasCluster")); |
| } |
| } |