@Test
  public void test_GatewaySender_without_Locator() {
    try {
      cache = new CacheFactory().set(MCAST_PORT, "0").create();

      GatewaySenderFactory fact = cache.createGatewaySenderFactory();
      fact.setParallel(true);
      GatewaySender sender1 = fact.create("NYSender", 2);
      sender1.start();
      fail("Expected IllegalStateException but not thrown");
    } catch (Exception e) {
      if ((e instanceof IllegalStateException && e.getMessage().startsWith(
          "Locators must be configured before starting gateway-sender."))) {
      } else {
        fail("Expected IllegalStateException but received :" + e);
      }
    }
  }
Test to validate that the sender can not be started without configuring locator
geode-wan/src/integrationTest/java/org/apache/geode/internal/cache/wan/misc/WANConfigurationJUnitTest.java