test_class.declarator: mapWithUuidKey
test_class.modifier: @Mock
test_class.original_string: @Mock
  	IMap<UUID, AggregateRootHistory> mapWithUuidKey;
test_class.type: IMap<UUID, AggregateRootHistory>
test_class.var_name: mapWithUuidKey
test_class.file: myeslib-hazelcast/src/test/java/org/myeslib/hazelcast/storage/HzUnitOfWorkJournalTest.java
test_class.identifier: HzUnitOfWorkJournalTest
test_case.body: @Test
  	public void oneTransaction() {
  		
  		UUID id = UUID.randomUUID();
  		Command command = new IncreaseInventory(UUID.randomUUID(), id, 1, 0L);
  		Event event1 = new InventoryIncreased(id, 1);
  		List<Event> events = Arrays.asList(event1);
  		UnitOfWork t = UnitOfWork.create(UUID.randomUUID(), command, events);
  		AggregateRootHistory toStore = new AggregateRootHistory();
  		toStore.add(t);
  		
  		// first get on map will returns null, second will returns toStore 
  		when(mapWithUuidKey.get(id)).thenReturn(null, toStore);
  		
  		HzUnitOfWorkJournal<UUID> store = new HzUnitOfWorkJournal<>(mapWithUuidKey);
  		store.append(id, t);
  
  		ArgumentCaptor<UUID> argumentKey = ArgumentCaptor.forClass(UUID.class);
  		ArgumentCaptor<AggregateRootHistory> argumentValue = ArgumentCaptor.forClass(AggregateRootHistory.class);
  
  		verify(mapWithUuidKey, times(1)).set(argumentKey.capture(), argumentValue.capture());
  		
  		// checks for key
  		assertThat(argumentKey.getValue(), sameInstance(id));
  
  		// checks for all transactions fields except the timestamp
  		AggregateRootHistory asObj = argumentValue.getValue();
  		UnitOfWork copy = asObj.getUnitsOfWork().get(0);
  		assertThat(copy.getCommand(), is(command));
  		assertThat(copy.getVersion(), is(1l));
  		assertThat("contains events", copy.getEvents().containsAll(events));
  
  	}
test_case.class_method_signature: HzUnitOfWorkJournalTest.oneTransaction()
test_case.full_signature: @Test public void oneTransaction()
test_case.identifier: oneTransaction
test_case.invocations: randomUUID randomUUID asList create randomUUID add thenReturn when get append forClass forClass set verify times capture capture assertThat getValue sameInstance getValue get getUnitsOfWork assertThat getCommand is assertThat getVersion is assertThat containsAll getEvents
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void oneTransaction()
focal_class.declarator: pastTransactionsMap
focal_class.modifier: private final
focal_class.original_string: private final IMap<K, AggregateRootHistory> pastTransactionsMap ;
focal_class.type: IMap<K, AggregateRootHistory>
focal_class.var_name: pastTransactionsMap
focal_class.file: myeslib-hazelcast/src/main/java/org/myeslib/hazelcast/storage/HzUnitOfWorkJournal.java
focal_class.identifier: HzUnitOfWorkJournal
focal_class.interfaces: implements UnitOfWorkJournal<K>
focal_class.class_method_signature: HzUnitOfWorkJournal.HzUnitOfWorkJournal(IMap<K, AggregateRootHistory> pastTransactionsMap)
focal_class.full_signature: @Inject public  HzUnitOfWorkJournal(IMap<K, AggregateRootHistory> pastTransactionsMap)
focal_class.identifier: HzUnitOfWorkJournal
focal_class.modifiers: @Inject public
focal_class.parameters: (IMap<K, AggregateRootHistory> pastTransactionsMap)
focal_class.signature:  HzUnitOfWorkJournal(IMap<K, AggregateRootHistory> pastTransactionsMap)
focal_class.class_method_signature: HzUnitOfWorkJournal.append(final K id, final UnitOfWork uow)
focal_class.full_signature: public void append(final K id, final UnitOfWork uow)
focal_class.identifier: append
focal_class.modifiers: public
focal_class.parameters: (final K id, final UnitOfWork uow)
focal_class.return: void
focal_class.signature: void append(final K id, final UnitOfWork uow)
focal_class.class_method_signature: HzUnitOfWorkJournal.getHistoryFor(final K id)
focal_class.full_signature: private AggregateRootHistory getHistoryFor(final K id)
focal_class.identifier: getHistoryFor
focal_class.modifiers: private
focal_class.parameters: (final K id)
focal_class.return: AggregateRootHistory
focal_class.signature: AggregateRootHistory getHistoryFor(final K id)
focal_method.body: public void append(final K id, final UnitOfWork uow) {
  		checkNotNull(id);
  		checkNotNull(uow);
  		final AggregateRootHistory history = getHistoryFor(id);
  		if (!history.getLastVersion().equals(uow.getTargetVersion())){
  			throw new ConcurrentModificationException(String.format("version %s does not match the expected %s ****", 
  																	history.getLastVersion().toString(), 
  																	uow.getTargetVersion().toString())
  													 );
  														
  		} 
  		log.info("will set {}", id);
  		history.add(uow);
  		pastTransactionsMap.set(id, history); // hazelcast optimization --> set instead of put since is void
  	}
focal_method.class_method_signature: HzUnitOfWorkJournal.append(final K id, final UnitOfWork uow)
focal_method.full_signature: public void append(final K id, final UnitOfWork uow)
focal_method.identifier: append
focal_method.invocations: checkNotNull checkNotNull getHistoryFor equals getLastVersion getTargetVersion format toString getLastVersion toString getTargetVersion info add set
focal_method.modifiers: public
focal_method.parameters: (final K id, final UnitOfWork uow)
focal_method.return: void
focal_method.signature: void append(final K id, final UnitOfWork uow)