@Test
public void testInvalidOSRegistration() throws Exception,
    InvalidStateTransitionException {

  ActionManager am = actionManagerTestHelper.getMockActionManager();
  replay(am);
  Clusters fsm = clusters;
  HeartBeatHandler handler = new HeartBeatHandler(fsm, new ActionQueue(), am,
      injector);
  clusters.addHost(DummyHostname1);
  Host hostObject = clusters.getHost(DummyHostname1);
  hostObject.setIPv4("ipv4");
  hostObject.setIPv6("ipv6");
  Register reg = new Register();
  HostInfo hi = new HostInfo();
  hi.setHostName(DummyHostname1);
  hi.setOS("MegaOperatingSystem");
  reg.setHostname(DummyHostname1);
  reg.setHardwareProfile(hi);
  reg.setAgentVersion(metaInfo.getServerVersion());
  try {
    handler.handleRegistration(reg);
    fail ("Expected failure for non matching os type");
  } catch (AmbariException e) {
    // Expected
  }
}