Esempio n. 1
0
  /** Test of get method, of class SAMPFactory. */
  public void testGet_Class() {
    TestInterface result = (TestInterface) SAMPFactory.get(TestInterface.class);
    List<String> methods = new ArrayList<>();
    List<String> exp_methods = new ArrayList<>();

    for (Method m : result.getClass().getDeclaredMethods()) methods.add(m.getName());

    for (Method m : TestInterface.class.getDeclaredMethods()) exp_methods.add(m.getName());

    assertTrue(methods.containsAll(exp_methods));

    result.setName("test name");
    result.setArray(new double[] {0.1, 0.2});

    result.getNested().setSomething("test something");

    assertEquals("test name", result.getName());
    assertTrue(Arrays.equals(new double[] {0.1, 0.2}, result.getArray()));
    assertEquals("test something", result.getNested().getSomething());

    result.addThing("Three");

    assertTrue(result.getThings().contains("Three"));
  }