@Test
public void testDefineMatchupPattern_onlyPrimarySensor() {

    final String primarySensorname = "atsr.3";
    final Stack<EntityTransaction> transactionStack = new Stack<>();
    final Sensor primarySensor = new SensorBuilder().name(primarySensorname).pattern(10).build();
    final EntityTransaction transaction = mock(EntityTransaction.class);
    final Storage storage = mock(Storage.class);
    final PersistenceManager persistenceManager = mock(PersistenceManager.class);
    when(persistenceManager.transaction()).thenReturn(transaction);
    when(persistenceManager.getStorage()).thenReturn(storage);
    when(storage.getSensor("orb_atsr.3")).thenReturn(primarySensor);
    final long pattern = MatchupGenerator.defineMatchupPattern(primarySensorname, null, 1000000L, persistenceManager, transactionStack);
    assertEquals(1000000L | 10L, pattern);
    verify(persistenceManager, times(1)).getStorage();
    verify(persistenceManager, times(1)).transaction();
    verify(persistenceManager, times(1)).commit();
    verifyNoMoreInteractions(persistenceManager);
    verify(storage, times(1)).getSensor("orb_atsr.3");
    verifyNoMoreInteractions(storage);
    assertEquals(1, transactionStack.size());
    assertSame(transaction, transactionStack.pop());
}