/**
  * Rigorous Test :-)
  *
  * @throws IOException
  */
 @Test
 public void testInstanceProp() throws IOException {
   App app = App.instance();
   Notify notify = app.getNotify("/notify/test");
   notify.replaceProperty("a".getBytes(), "I Love it.".getBytes());
   byte[] v = notify.getProperty("a".getBytes());
   System.out.println(new String(v));
 }
 @Test
 public void testGetNotify() throws Exception {
   Notify notify1 = APP.getNotify("/notify/test");
   Notify notify2 = APP.getNotify("/notify/test/tmp");
   Notify notify3 = APP.getNotify(new String("/notify/test/tmp"));
   assertNotEquals(notify1, notify2);
   assertEquals(notify3, notify2);
 }
 @Test(expected = NullPointerException.class)
 public void testClose() throws Exception {
   App app = new App(URL, 10000);
   app.notifyMap = null;
   try {
     app.getNotify("/notify/test");
   } finally {
     app.close();
   }
 }
 public static void setUp() {
   try {
     App.init(URL, 10000);
   } catch (IOException e) {
     throw new IllegalStateException("Failed to connect to ZK.", e);
   }
 }
Exemple #5
0
 @Test
 public void test() {
   assertThat(App.sayHello(), is("Hello, world."));
 }
Exemple #6
0
 @Test
 @Points("maven-exercise")
 public void trol() {
   App.main(null);
   assertTrue(true);
 }
 @Test
 public void testAnotherMethod() {
   App.doNothing();
 }
Exemple #8
0
 @Test
 public void testSum() {
   int x = App.sum(1, 2);
   assertEquals(3, x);
 }
 @Test
 public void testInit() throws Exception {
   App.init("not yet implemented", 10000);
   assertEquals(APP, App.instance());
 }
Exemple #10
0
 /**
  * Rigorous Test :-)
  *
  * @throws IOException
  */
 @Test
 public void testAppNull() throws IOException {
   App app = App.instance();
   Notify notify = app.getNotify("/notify/test/tmplevt");
   assertNull(notify);
 }
Exemple #11
0
 public static void cleanZK(String base) {
   if (APP.exists(base)) {
     APP.deleteTree(base);
   }
   APP.makeSurePathExists(base);
 }
Exemple #12
0
 static {
   setUp();
   APP = App.instance();
   cleanZK("/notify/test/tmp");
 }