src_fm_fc_ms_ff stringlengths 43 86.8k | target stringlengths 20 276k |
|---|---|
JDKImperativeDeckOfCardsAsList { public Map<Rank, Long> countsByRank() { var result = new HashMap<Rank, Long>(); for (var card : this.cards) { var rank = card.rank(); var value = result.computeIfAbsent(rank, r -> Long.valueOf(0)); result.put(rank, value + 1); } return result; } JDKImperativeDeckOfCardsAsList(); Deque<C... | @Test public void countsByRank() { Assert.assertEquals(Long.valueOf(4), this.jdkDeck.countsByRank().get(Rank.TEN)); } |
VavrDeckOfCardsAsList { public List<Card> getCards() { return this.cards; } VavrDeckOfCardsAsList(); List<Card> shuffle(Random random); Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); List<Set<Card>> dealHands(
... | @Test public void allCards() { Assert.assertEquals(this.jdkDeck.getCards(), this.vavrDeck.getCards().toJavaList()); } |
VavrDeckOfCardsAsList { public List<Card> diamonds() { return null; } VavrDeckOfCardsAsList(); List<Card> shuffle(Random random); Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); List<Set<Card>> dealHands(
... | @Test public void diamonds() { Assert.assertEquals(this.jdkDeck.diamonds(), this.vavrDeck.diamonds().toJavaList()); } |
VavrDeckOfCardsAsList { public List<Card> hearts() { return null; } VavrDeckOfCardsAsList(); List<Card> shuffle(Random random); Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); List<Set<Card>> dealHands(
Li... | @Test public void hearts() { Assert.assertEquals(this.jdkDeck.hearts(), this.vavrDeck.hearts().toJavaList()); } |
VavrDeckOfCardsAsList { public List<Card> spades() { return null; } VavrDeckOfCardsAsList(); List<Card> shuffle(Random random); Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); List<Set<Card>> dealHands(
Li... | @Test public void spades() { Assert.assertEquals(this.jdkDeck.spades(), this.vavrDeck.spades().toJavaList()); } |
VavrDeckOfCardsAsList { public List<Card> clubs() { return null; } VavrDeckOfCardsAsList(); List<Card> shuffle(Random random); Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); List<Set<Card>> dealHands(
Lis... | @Test public void clubs() { Assert.assertEquals(this.jdkDeck.clubs(), this.vavrDeck.clubs().toJavaList()); } |
EclipseCollectionsDeckOfCardsAsList { public MutableSet<Card> deal(MutableStack<Card> stack, int count) { return stack.pop(count).toSet(); } EclipseCollectionsDeckOfCardsAsList(); MutableStack<Card> shuffle(Random random); MutableSet<Card> deal(MutableStack<Card> stack, int count); ImmutableList<Set<Card>> shuffleAndDe... | @Test public void deal() { var ecShuffle = this.ecDeck.shuffle(new Random(1)); var jdkShuffle = this.jdkDeck.shuffle(new Random(1)); var ecHand = this.ecDeck.deal(ecShuffle, 5); var jdkHand = this.jdkDeck.deal(jdkShuffle, 5); Assert.assertEquals(jdkHand, ecHand); } |
VavrDeckOfCardsAsList { public Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count) { var hand = HashSet.<Card>empty(); for (int i = 0; i < count; i++) { var cardTuple2 = stack.pop2(); stack = cardTuple2._2(); hand = hand.add(cardTuple2._1()); } return Tuple.of(hand, stack); } VavrDeckOfCardsAsList... | @Test public void deal() { var jdkShuffle = this.jdkDeck.shuffle(new Random(1)); var vavrShuffle = this.vavrDeck.shuffle(new Random(1)); var jdkHand = this.jdkDeck.deal(jdkShuffle, 5); var vavrHand = this.vavrDeck.deal(vavrShuffle, 5)._1().toJavaSet(); Assert.assertEquals(jdkHand, vavrHand); } |
VavrDeckOfCardsAsList { public List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand) { var shuffled = this.shuffle(random); return this.dealHands(shuffled, hands, cardsPerHand); } VavrDeckOfCardsAsList(); List<Card> shuffle(Random random); Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> sta... | @Test public void shuffleAndDealHands() { var jdkHands = this.jdkDeck.shuffleAndDeal(new Random(1), 5, 5); var vavrHands = this.vavrDeck.shuffleAndDeal(new Random(1), 5, 5); Assert.assertEquals(jdkHands.get(0), vavrHands.get(0).toJavaSet()); Assert.assertEquals(jdkHands.get(1), vavrHands.get(1).toJavaSet()); Assert.ass... |
VavrDeckOfCardsAsList { public List<Set<Card>> dealHands( List<Card> shuffled, int hands, int cardsPerHand) { return null; } VavrDeckOfCardsAsList(); List<Card> shuffle(Random random); Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int... | @Test public void dealHands() { var jdkShuffled = this.jdkDeck.shuffle(new Random(1)); var vavrShuffled = this.vavrDeck.shuffle(new Random(1)); var jdkHands = this.jdkDeck.dealHands(jdkShuffled, 5, 5); var vavrHands = this.vavrDeck.dealHands(vavrShuffled, 5, 5); Assert.assertEquals(jdkHands.get(0), vavrHands.get(0).toJ... |
VavrDeckOfCardsAsList { public Map<Suit, ? extends List<Card>> getCardsBySuit() { return this.cardsBySuit; } VavrDeckOfCardsAsList(); List<Card> shuffle(Random random); Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); ... | @Test public void cardsBySuit() { var jdkCardsBySuit = this.jdkDeck.getCardsBySuit(); var vavrCardsBySuit = this.vavrDeck.getCardsBySuit(); Assert.assertEquals(jdkCardsBySuit.get(Suit.CLUBS), vavrCardsBySuit.get(Suit.CLUBS).get().toJavaList()); } |
VavrDeckOfCardsAsList { public Map<Suit, Long> countsBySuit() { return null; } VavrDeckOfCardsAsList(); List<Card> shuffle(Random random); Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); List<Set<Card>> dealHands(
... | @Test public void countsBySuit() { Assert.assertEquals( this.jdkDeck.countsBySuit().get(Suit.CLUBS), this.vavrDeck.countsBySuit().get(Suit.CLUBS).get()); } |
VavrDeckOfCardsAsList { public Map<Rank, Long> countsByRank() { return null; } VavrDeckOfCardsAsList(); List<Card> shuffle(Random random); Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count); List<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); List<Set<Card>> dealHands(
... | @Test public void countsByRank() { Assert.assertEquals( this.jdkDeck.countsByRank().get(Rank.TEN), this.vavrDeck.countsByRank().get(Rank.TEN).get()); } |
HashSetMultimap extends AbstractMutableMultimap<K, V, MutableSet<V>> implements MutableSetMultimap<K, V> { @Override public int size() { return this.size; } static HashSetMultimap<K, V> newMultimap(); @Override int size(); } | @Test public void get_put() { this.testObj.put("A", 1); Assert.assertEquals(MutableSet.of(1), this.testObj.get("A")); Assert.assertEquals(1, this.testObj.size()); this.testObj.put("A", 2); Assert.assertEquals(MutableSet.of(1, 2), this.testObj.get("A")); Assert.assertEquals(2, this.testObj.size()); this.testObj.put("A",... |
EclipseCollectionsDeckOfCardsAsList { public ImmutableList<Set<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand) { var shuffled = this.shuffle(random); return this.dealHands(shuffled, hands, cardsPerHand); } EclipseCollectionsDeckOfCardsAsList(); MutableStack<Card> shuffle(Random random); MutableSet<Car... | @Test public void shuffleAndDealHands() { var ecHands = this.ecDeck.shuffleAndDeal(new Random(1), 5, 5); var jdkHands = this.jdkDeck.shuffleAndDeal(new Random(1), 5, 5); Assert.assertEquals(jdkHands, ecHands); } |
HashSetMultimap extends AbstractMutableMultimap<K, V, MutableSet<V>> implements MutableSetMultimap<K, V> { public static <K, V> HashSetMultimap<K, V> newMultimap() { return new HashSetMultimap<>(); } static HashSetMultimap<K, V> newMultimap(); @Override int size(); } | @Test public void hashCodeEquals() { this.testObj.putAll(MutableMap.of("A", MutableList.of(1, 2, 3, 1))); this.testObj.putAll(MutableMap.of("B", MutableList.of(10, 10))); HashSetMultimap<String, Integer> other = HashSetMultimap.newMultimap(); other.putAll(MutableMap.of("A", MutableList.of(1, 2, 3, 1))); Assert.assertTr... |
CustomCollectionsDeckOfCardsAsList { public MutableList<Card> getCards() { return this.cards; } CustomCollectionsDeckOfCardsAsList(); Deque<Card> shuffle(Random random); MutableSet<Card> deal(Deque<Card> deque, int count); MutableList<MutableSet<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand); Mutable... | @Test public void allCards() { Assert.assertEquals(this.jdkDeck.getCards(), this.customDeck.getCards()); }
@Test public void cardsAreImmutable() { var jdk2Cards = this.customDeck.getCards(); Verify.assertThrows( UnsupportedOperationException.class, () -> jdk2Cards.remove(0)); Verify.assertThrows( UnsupportedOperationEx... |
CustomCollectionsDeckOfCardsAsList { public MutableList<Card> diamonds() { return this.cardsBySuit.get(Suit.DIAMONDS); } CustomCollectionsDeckOfCardsAsList(); Deque<Card> shuffle(Random random); MutableSet<Card> deal(Deque<Card> deque, int count); MutableList<MutableSet<Card>> shuffleAndDeal(Random random, int hands, i... | @Test public void diamonds() { Assert.assertEquals(this.jdkDeck.diamonds(), this.customDeck.diamonds()); } |
CustomCollectionsDeckOfCardsAsList { public MutableList<Card> hearts() { return this.cardsBySuit.get(Suit.HEARTS); } CustomCollectionsDeckOfCardsAsList(); Deque<Card> shuffle(Random random); MutableSet<Card> deal(Deque<Card> deque, int count); MutableList<MutableSet<Card>> shuffleAndDeal(Random random, int hands, int c... | @Test public void hearts() { Assert.assertEquals(this.jdkDeck.hearts(), this.customDeck.hearts()); } |
CustomCollectionsDeckOfCardsAsList { public MutableList<Card> spades() { return this.cardsBySuit.get(Suit.SPADES); } CustomCollectionsDeckOfCardsAsList(); Deque<Card> shuffle(Random random); MutableSet<Card> deal(Deque<Card> deque, int count); MutableList<MutableSet<Card>> shuffleAndDeal(Random random, int hands, int c... | @Test public void spades() { Assert.assertEquals(this.jdkDeck.spades(), this.customDeck.spades()); } |
CustomCollectionsDeckOfCardsAsList { public MutableList<Card> clubs() { return this.cardsBySuit.get(Suit.CLUBS); } CustomCollectionsDeckOfCardsAsList(); Deque<Card> shuffle(Random random); MutableSet<Card> deal(Deque<Card> deque, int count); MutableList<MutableSet<Card>> shuffleAndDeal(Random random, int hands, int car... | @Test public void clubs() { Assert.assertEquals(this.jdkDeck.clubs(), this.customDeck.clubs()); } |
CustomCollectionsDeckOfCardsAsList { public MutableSet<Card> deal(Deque<Card> deque, int count) { var hand = MutableSet.<Card>empty(); IntStream.range(0, count).forEach(i -> hand.add(deque.pop())); return hand; } CustomCollectionsDeckOfCardsAsList(); Deque<Card> shuffle(Random random); MutableSet<Card> deal(Deque<Card>... | @Test public void deal() { var jdk1Shuffle = this.jdkDeck.shuffle(new Random(1)); var jdk2Shuffle = this.customDeck.shuffle(new Random(1)); var jdk1Hand = this.jdkDeck.deal(jdk1Shuffle, 5); var jdk2Hand = this.customDeck.deal(jdk2Shuffle, 5); Assert.assertEquals(jdk1Hand, jdk2Hand); } |
EclipseCollectionsDeckOfCardsAsList { public ImmutableList<Set<Card>> dealHands( MutableStack<Card> shuffled, int hands, int cardsPerHand) { return null; } EclipseCollectionsDeckOfCardsAsList(); MutableStack<Card> shuffle(Random random); MutableSet<Card> deal(MutableStack<Card> stack, int count); ImmutableList<Set<Card... | @Test public void dealHands() { var ecShuffled = this.ecDeck.shuffle(new Random(1)); var jdkShuffled = this.jdkDeck.shuffle(new Random(1)); var ecHands = this.ecDeck.dealHands(ecShuffled, 5, 5); var jdkHands = this.jdkDeck.dealHands(jdkShuffled, 5, 5); Assert.assertEquals(jdkHands, ecHands); } |
CustomCollectionsDeckOfCardsAsList { public MutableList<MutableSet<Card>> shuffleAndDeal(Random random, int hands, int cardsPerHand) { var shuffled = this.shuffle(random); return this.dealHands(shuffled, hands, cardsPerHand); } CustomCollectionsDeckOfCardsAsList(); Deque<Card> shuffle(Random random); MutableSet<Card> d... | @Test public void shuffleAndDealHands() { var jdk1Hands = this.jdkDeck.shuffleAndDeal(new Random(1), 5, 5); var jdk2Hands = this.customDeck.shuffleAndDeal(new Random(1), 5, 5); Assert.assertEquals(jdk1Hands, jdk2Hands); } |
CustomCollectionsDeckOfCardsAsList { public MutableList<MutableSet<Card>> dealHands(Deque<Card> shuffled, int hands, int cardsPerHand) { return MutableList.fromStream(IntStream.range(0, hands) .mapToObj(each -> this.deal(shuffled, cardsPerHand))) .asUnmodifiable(); } CustomCollectionsDeckOfCardsAsList(); Deque<Card> sh... | @Test public void dealHands() { var jdk1Shuffled = this.jdkDeck.shuffle(new Random(1)); var jdk2Shuffled = this.customDeck.shuffle(new Random(1)); var jdk1Hands = this.jdkDeck.dealHands(jdk1Shuffled, 5, 5); var jdk2Hands = this.customDeck.dealHands(jdk2Shuffled, 5, 5); Assert.assertEquals(jdk1Hands, jdk2Hands); } |
CustomCollectionsDeckOfCardsAsList { public MutableListMultimap<Suit, Card> getCardsBySuit() { return this.cardsBySuit; } CustomCollectionsDeckOfCardsAsList(); Deque<Card> shuffle(Random random); MutableSet<Card> deal(Deque<Card> deque, int count); MutableList<MutableSet<Card>> shuffleAndDeal(Random random, int hands, ... | @Test public void cardsBySuit() { var jdk1CardsBySuit = this.jdkDeck.getCardsBySuit(); var jdk2CardsBySuit = this.customDeck.getCardsBySuit(); Assert.assertEquals(jdk1CardsBySuit.get(Suit.CLUBS), jdk2CardsBySuit.get(Suit.CLUBS)); }
@Test public void cardsBySuitIsImmutable() { var jdk2CardsBySuit = this.customDeck.getCa... |
CustomCollectionsDeckOfCardsAsList { public MutableBag<Suit> countsBySuit() { return this.cards.countBy(Card::suit); } CustomCollectionsDeckOfCardsAsList(); Deque<Card> shuffle(Random random); MutableSet<Card> deal(Deque<Card> deque, int count); MutableList<MutableSet<Card>> shuffleAndDeal(Random random, int hands, int... | @Test public void countsBySuit() { for (Suit suit : Suit.values()) { Assert.assertEquals( this.jdkDeck.countsBySuit().get(suit).intValue(), this.customDeck.countsBySuit().getOccurrences(suit)); } } |
CustomCollectionsDeckOfCardsAsList { public MutableBag<Rank> countsByRank() { return this.cards.countBy(Card::rank); } CustomCollectionsDeckOfCardsAsList(); Deque<Card> shuffle(Random random); MutableSet<Card> deal(Deque<Card> deque, int count); MutableList<MutableSet<Card>> shuffleAndDeal(Random random, int hands, int... | @Test public void countsByRank() { for (Rank rank : Rank.values()) { Assert.assertEquals( this.jdkDeck.countsByRank().get(rank).intValue(), this.customDeck.countsByRank().getOccurrences(rank)); } } |
HashBag implements MutableBag<T> { HashBag<T> withAll(T... elements) { for (T element : elements) { this.backingMap.merge(element, 1, (existingValue, newValue) -> existingValue + 1); this.size++; } return this; } @Override int sizeDistinct(); @Override int size(); @Override boolean isEmpty(); @Override boolean contain... | @Test public void withAll() { HashBag<String> bag = this.testObj.withAll("1", "2", "3", "2", "3", "3"); Assert.assertEquals(1, bag.getOccurrences("1")); Assert.assertEquals(2, bag.getOccurrences("2")); Assert.assertEquals(3, bag.getOccurrences("3")); } |
HashBag implements MutableBag<T> { @Override public boolean isEmpty() { return this.size == 0; } @Override int sizeDistinct(); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Object[] toArray(); void forEachWithIndex(BiConsumer<? super T, Integer> biConsumer); @Overri... | @Test public void isEmpty() { Assert.assertTrue(this.testObj.isEmpty()); this.testObj.withAll("1", "2", "3", "2", "3", "3"); Assert.assertFalse(this.testObj.isEmpty()); } |
HashBag implements MutableBag<T> { @Override public boolean contains(Object o) { return this.backingMap.containsKey(o); } @Override int sizeDistinct(); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Object[] toArray(); void forEachWithIndex(BiConsumer<? super T, Inte... | @Test public void contains() { Assert.assertFalse(this.testObj.contains("1")); this.testObj.withAll("1", "2", "3", "2", "3", "3"); Assert.assertTrue(this.testObj.contains("1")); Assert.assertFalse(this.testObj.contains("4")); } |
HashBag implements MutableBag<T> { @Override public Object[] toArray() { Object[] result = new Object[this.size()]; this.forEachWithIndex((each, index) -> result[index] = each); return result; } @Override int sizeDistinct(); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Over... | @Test public void toArray() { Assert.assertArrayEquals(new String[]{}, this.testObj.toArray()); this.testObj.withAll("1", "2", "3", "2", "3", "3"); Assert.assertArrayEquals(new String[]{"1", "2", "2", "3", "3", "3"}, this.testObj.toArray()); } |
AuthenticationController { @DELETE @Path("{userName}") @Consumes(MediaType.APPLICATION_JSON + ";charset=UTF-8") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") public Response<AccountEntry> deleteAccount(Request<AccountEntry> request, @PathParam("userName") String userName) { Data<AccountEntry> data, returnDat... | @Test public void testDeleteAccount() { } |
DimeServiceAdapter extends ServiceAdapterBase implements InternalServiceAdapter { @Override public String getAdapterName() { return DimeServiceAdapter.NAME; } DimeServiceAdapter(String identifier); void setProxyFactory(ProxyFactory proxyFactory); void setAccountRegistrar(AccountRegistrar accountRegistrar); void setPubl... | @Test public void testGetAdapterName() throws Exception { DimeServiceAdapter adapter = new DimeServiceAdapter("test"); assertEquals("di.me", adapter.getAdapterName()); } |
DimeServiceAdapter extends ServiceAdapterBase implements InternalServiceAdapter { public PersonContact getProfile(String targetSaidName, Token token) throws AttributeNotSupportedException, ServiceNotAvailableException { HttpRestProxy proxy = null; PersonContact profile = null; final String path = SHARED_PROFILE_PATH.re... | @Test public void testGetProfile() throws Exception { String said = "12345"; URL baseUrl = new URL("http: String path = "/api/dime/rest/:target/shared/profile".replace(":target", said); String json = "[{`@context`:{`nco`:`http: URI profileUri = new URIImpl("urn:uuid:3dcb73e4-399f-41af-b4f2-a8bb48c315a1"); URI phoneUri ... |
AttributeMap { public String getAttribute (String input) { Iterator<String> iterator = this.attributes.iterator(); while (iterator.hasNext()) { String candidate = iterator.next(); String attr = candidate.replaceAll("\\{\\w+\\}", "([^/]+)"); if (input.matches(attr)) { return candidate; } } return null; } AttributeMap();... | @Test public void testGetAttribute() { AttributeMap attributeMap = new AttributeMap(); assertTrue("Wrong mapping found for getAttribute(/event/@all).", attributeMap.getAttribute("/event/@all").equals(AttributeMap.EVENT_ALL)); assertTrue("Wrong mapping found for getAttribute(/event/@me/123).", attributeMap.getAttribute(... |
AttributeMap { public Map<String, String> extractIds (String attribute, String input) { HashMap<String, String> idMap = new HashMap<String, String>(); Iterator<String> iterator = this.idnames.iterator(); while (iterator.hasNext()) { String candidate = iterator.next(); String attr = attribute.replaceAll("\\{"+candidate+... | @Test public void testExtractIds() { AttributeMap attributeMap = new AttributeMap(); Map<String, String> details = attributeMap.extractIds(AttributeMap.EVENT_ALL, "/event/@all"); assertTrue("Wrong eventId detected for /event/@all", details.get(AttributeMap.EVENT_ID) == null); assertTrue("Wrong userId detected for /even... |
HistoryLogService { public URI createLogForContext(URI contextGraph) { TripleStore tripleStore = resourceStore.getTripleStore(); URI logGraph = resourceStore.createGraph(DUHO.ContextLog); URI metadataGraph = tripleStore.getOrCreateMetadataGraph(logGraph); Model metadata = RDF2Go.getModelFactory().createModel().open(); ... | @Test public void testCreateLogForContext() throws ResourceExistsException { URI liveContext = new URIImpl("urn:live-context"); Environment environment = modelFactory.getDCONFactory().createEnvironment(); URI temperatureUri = new URIImpl("urn:temperature:123"); environment.setCurrentTemperature(temperatureUri); resourc... |
HistoryLogService { public URI createLogForPrivacyPreference(PrivacyPreference privacyPref) { TripleStore tripleStore = resourceStore.getTripleStore(); URI logGraph = resourceStore.createGraph(DUHO.PrivacyPreferenceLog); URI metadataGraph = tripleStore.getOrCreateMetadataGraph(logGraph); tripleStore.addAll(logGraph, pr... | @Test public void testCreateLogForPrivacyPreference() throws ResourceExistsException { URI testGraph = new URIImpl("test:graph"); URI group1 = new URIImpl("urn:group:1"); URI person3 = new URIImpl("urn:person:3"); URI person14 = new URIImpl("urn:person:14"); PrivacyPreference privacyPref = modelFactory.getPPOFactory().... |
AspectBasedStrategy implements UpdateStrategy { @Override public void update(List<Statement> toAdd, List<Statement> toRemove) { ClosableIterator<Statement> lcStmts = liveContext.iterator(); List<URI> aspects = new ArrayList<URI>(); List<Statement> toKeep = new ArrayList<Statement>(); while (lcStmts.hasNext()) { Stateme... | @Test public void testUpdateSeveralResources() throws LiveContextException { List<Statement> toAdd = new ArrayList<Statement>(); List<Statement> toRemove = new ArrayList<Statement>(); URI environment = new URIImpl("urn:uuid:"+UUID.randomUUID()); URI temp = new URIImpl("urn:uuid:"+UUID.randomUUID()); URI weather = new U... |
ElementBasedStrategy implements UpdateStrategy { @Override public void update(List<Statement> toAdd, List<Statement> toRemove) { Model newData = RDF2Go.getModelFactory().createModel().open(); for (Statement s : toAdd) { newData.addStatement(s); } Set<URI> elements = new HashSet<URI>(); elements.addAll(findElements(toAd... | @Test public void testAddElementToLiveContext() throws Exception { List<Statement> toAdd = new ArrayList<Statement>(); List<Statement> toRemove = new ArrayList<Statement>(); URI ismael = new URIImpl("urn:ismael"); toAdd.add(new StatementImpl(null, PEERS, DCON.nearbyPerson, ismael)); strategy.update(toAdd, toRemove); to... |
AuthenticationController { @GET @Produces(MediaType.APPLICATION_JSON) @Path("/credentials/{contact-said}") public Response<AccountEntry> getCredentials( @PathParam("said") String saidLocal, @PathParam("contact-said") String saidRequester) throws DimeException { Data<AccountEntry> data = new Data<AccountEntry>(); boolea... | @Test public void testGetCredentials() { try { Response<AccountEntry> response = authenticationController.getCredentials(SAID_LOCAL, SAID_REMOTE); Collection<AccountEntry> col = response.getMessage().getData().getEntries(); AccountEntry account = col.iterator().next(); String tmpPassword = account.getPassword(); respon... |
SnapshotBasedStrategy implements UpdateStrategy { @Override public void update(List<Statement> toAdd, List<Statement> toRemove) { previousContext.removeAll(); previousContext.addAll(liveContext.iterator()); liveContext.removeAll(toRemove.iterator()); liveContext.addAll(toAdd.iterator()); } SnapshotBasedStrategy(Model p... | @Test public void testUpdateSeveralResources() throws LiveContextException { List<Statement> toAdd = new ArrayList<Statement>(); List<Statement> toRemove = new ArrayList<Statement>(); URI environment = new URIImpl("urn:uuid:"+UUID.randomUUID()); URI temp = new URIImpl("urn:uuid:"+UUID.randomUUID()); URI weather = new U... |
EvaluationData { public static long countEvaluationDatas() { return entityManager().createQuery("SELECT COUNT(o) FROM EvaluationData o", Long.class).getSingleResult(); } String toString(); String getInvolvedItems(); void setInvolvedItems(String involvedItems); Long getId(); void setId(Long id); Integer getVersion(); v... | @Test public void testMethod() { int expectedCount = 13; EvaluationData.countEvaluationDatas(); org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl.expectReturn(expectedCount); org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl.playback(); org.junit.Assert.assertEq... |
LivePostDecomposer { public List<LivePost> decompose(LivePost livepost) throws DataMiningException { List<LivePost> liveposts = new ArrayList<LivePost>(); if (!livepost.hasTextualContent()) { throw new DataMiningException("Livepost "+livepost.asResource()+" cannot be decomposed, no textual content is provided."); } els... | @Test public void testDecomposeVideoAndImage() throws Exception { LivePost livepost = buildLivePost("Love this song!! http: List<LivePost> liveposts = decomposer.decompose(livepost); assertEquals(4, liveposts.size()); assertTrue(liveposts.contains(livepost)); LivePost parent = null; ImagePost imagePost = null; VideoPos... |
StreamAccountUpdater extends AccountUpdaterBase implements AccountUpdater<LivePost> { @Override public void update(URI accountUri, String path, LivePost livepost) throws AccountIntegrationException { Collection<LivePost> liveposts = new ArrayList<LivePost>(1); liveposts.add(livepost); update(accountUri, path, liveposts... | @Test public void testAddTwoStreams() throws Exception { Account linkedin = modelFactory.getDAOFactory().createAccount("urn:service:linkedin"); linkedin.setPrefLabel("LinkedIn"); resourceStore.createOrUpdate(null, linkedin); ResourceStore data = null; Collection<LivePost> messages = new ArrayList<LivePost>(); data = cr... |
ProfileAccountUpdater extends AccountUpdaterBase implements AccountUpdater<PersonContact> { @Override public void update(URI accountUri, String path, PersonContact contact) throws AccountIntegrationException { logger.info("Updating "+path+" for "+accountUri+" with 1 contact."); URI accountPathGraph = getGraph(accountUr... | @Test public void testAddContacts() throws Exception { Account linkedin = modelFactory.getDAOFactory().createAccount("urn:service:linkedin"); linkedin.setPrefLabel("LinkedIn"); pimoService.create(linkedin); ResourceStore data = createResourceStore( this.getClass().getClassLoader().getResourceAsStream("account/linkedin-... |
AuthenticationController { @POST @Produces(MediaType.APPLICATION_JSON) @Path("/credentials/{contact-said}") public Response<?> confirmCredentials( @PathParam("said") String saidLocal, @PathParam("contact-said") String saidRequester) { User user = userManager.getUserForAccountAndTenant(saidRequester, saidLocal); if (use... | @Test public void testConfirmCredentials() { authenticationController.confirmCredentials("", ""); } |
PostalAddressExtractor extends Base { public ResourceModel extract(ResourceModel postalAddress) throws DataMiningException { ResourceModel result = new ResourceModelImpl(postalAddress.getModel(), postalAddress.getIdentifier()); String content = postalAddress.getString(NAO.prefLabel); if ((content == null) || (content.t... | @Test public void testEmptyPostalAddressExtraction() throws ModelRuntimeException, IOException, DataMiningException { Model model = RDF2Go.getModelFactory().createModel(); model.open(); URI addr = model.createURI("urn:juan:loc36"); ResourceModel resourceModel = new ResourceModelImpl(addr); resourceModel.set(NAO.prefLab... |
FullnameExtractor extends Base { public ResourceModel extract(ResourceModel personName) throws DataMiningException { ResourceModel result = new ResourceModelImpl(personName.getModel(), personName.getIdentifier()); String content = personName.getString(NCO.fullname); if ((content == null) || (content.trim().isEmpty())) ... | @Test public void testEmptyFullnameExtraction() throws ModelRuntimeException, IOException, DataMiningException { Model model = RDF2Go.getModelFactory().createModel(); model.open(); URI name = model.createURI("urn:juan:personName4"); ResourceModel resourceModel = new ResourceModelImpl(name); resourceModel.set(NCO.fullna... |
PSEvaluationController { @POST @Path("/@me") @Consumes(MediaType.APPLICATION_JSON + ";charset=UTF-8") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") public Response<Evaluation> saveEvaluation(@PathParam("said") String said, Request<Evaluation> request) { try { RequestValidator.validateRequest(request); Data<E... | @Ignore @Test public void testSaveEvaluationOK(){ Request<Evaluation> request = buildSaveEvaluationRequest(); Response<Evaluation> response = controller.saveEvaluation(said, request); assertNotNull(response); Evaluation ev = response.getMessage().getData().getEntries().iterator().next(); assertNotNull(ev); assertEquals... |
JSONLDUtils { public static <T extends Resource> T deserialize(Object object, Class<T> returnType) throws JsonParseException, JsonMappingException, JSONLDProcessingError { RDF2GoTripleCallback callback = new RDF2GoTripleCallback(); ModelSet modelSet = toRDF(object, callback); URI subject = null; ClosableIterator<Statem... | @Test public void shouldDeserializeJSONLD() throws JsonParseException, JsonMappingException, JSONLDProcessingError { String json = "{`@graph`:[{`@id`:`urn:uuid:4182dcd4-a510-4b0c-8145-271a3dcfe455`,`@type`:[`http: PersonContact resource = JSONLDUtils.deserialize(json, PersonContact.class); Model metadata = resource.get... |
LocationContextUpdater implements LiveContextUpdater, IContextListener { @Override public void contextChanged(RawContextNotification notification) throws Exception { String name = notification.getName(); logger.debug("Current Place Raw Context notification received: " + name); StringTokenizer tok = new StringTokenizer(... | @Test public void testUpdateCurrentPlace() { try { RawContextNotification notification = createNotification(user1, currentPlace); SpaTem spatem = liveContextService.get(SpaTem.class); ClosableIterator<Place> places = spatem.getAllCurrentPlace(); rawContextUpdater.contextChanged(notification); spatem = liveContextServic... |
TimePeriodUpdater implements LiveContextUpdater { protected List<URI> findTimePeriods(ResourceStore resourceStore, Calendar when) { int hour = when.get(Calendar.HOUR_OF_DAY); int dayOfWeek = getDayOfWeekFromMonday(when); int dayOfMonth = when.get(Calendar.DAY_OF_MONTH); int weekOfYear = when.get(Calendar.WEEK_OF_YEAR);... | @Test public void testHour() throws Exception { assertTrue(timePeriodUpdater.findTimePeriods(this.resourceStore, MAY18AT1339).contains(AFTERNOON)); }
@Test public void testDayOfWeek() throws Exception { assertTrue(timePeriodUpdater.findTimePeriods(this.resourceStore, MAY18AT1339).contains(FRIDAY)); }
@Test public void ... |
ActivityContextUpdater implements LiveContextUpdater, IContextListener { @Override public void contextChanged(RawContextNotification notification) throws Exception { String name = notification.getName(); logger.debug("Raw Activity Context notification received: " + name); StringTokenizer tok = new StringTokenizer(name,... | @Test public void testUpdateActivity() { try { List<Node> activities = new ArrayList<Node>(); RawContextNotification notification = createNotification(user1,currentActivity); rawContextUpdater.contextChanged(notification); State state = liveContextService.get(State.class); ClosableIterator<Statement> currentIt = state.... |
ActivityDetector implements IContextProvider { protected String getActivity(IEntity entity, IContextElement[] addrs) { if (addrs.length != 0) { int index = Utility.getFirstSignificativeItem(addrs,Defaults.ACTIVITY_PERIOD,Defaults.ACTIVITY_TOLERANCE); if (index == -1) { logger.debug("Received civil addresses are too rec... | @Test public void testActivityNoRecentData() { IContextElement[] addrs = { ContextHelper.createCivilAddress(System.currentTimeMillis() - ((15) * 1000), 600, "place1"), ContextHelper.createCivilAddress(System.currentTimeMillis() - ((Defaults.ACTIVITY_PERIOD + Defaults.ACTIVITY_TOLERANCE + 10) * 1000), 600, "place1") }; ... |
WiFiContextUpdater implements LiveContextUpdater, IContextListener { @Override public void contextChanged(RawContextNotification notification) throws Exception { String name = notification.getName(); logger.debug("Raw WiFi Context notification received: " + name); StringTokenizer tok = new StringTokenizer(name,","); IE... | @Test public void testUpdateWifi() { try { Tenant t1 = entityFactory.buildTenant(); t1.setName(user1.getEntityIDAsString()); t1.setId(new Long(2)); RawContextNotification notification = createNotification(t1,user1,wifi); rawContextUpdater.contextChanged(notification); Connectivity conn = liveContextService.get(Connecti... |
SharingNotifier implements BroadcastReceiver { @Override public void onReceive(Event event) { if (notifierManager == null) { logger.warn("NotifierManager bean not set for SharingNotifier: " + "notifications for sharing actions won't be sent!"); return; } Tenant tenant = TenantHelper.getTenant(event.getTenantId()); Conn... | @Test public void testShareWithAccount() throws Exception { LivePost livePost = createLivePost("Hello sharing!", pimoService.getUser()); PrivacyPreference preference = modelFactory.getPPOFactory().createPrivacyPreference(); preference.setLabel(PrivacyPreferenceType.LIVEPOST.name()); preference.setCreator(pimoService.ge... |
CRUDNotifier implements BroadcastReceiver { @Override public void onReceive(Event event) { final String action = event.getAction(); if (!ArrayUtils.contains(ACTIONS, action)) { return; } final String itemId = event.getIdentifier().toString(); final Resource resource = event.getData(); if (NOTIFY_ACTIONS.containsKey(act... | @Test public void testCreatePersonGroup() { PersonGroup group = modelFactory.getPIMOFactory().createPersonGroup(); group.setCreator(new URIImpl("urn:test")); Event event = new Event(connection.getName(), Event.ACTION_RESOURCE_ADD, group); notifier.onReceive(event); assertEquals(1, notifierManager.internal.size()); Dime... |
AMETICDummyAdapter extends BasicAuthServiceAdapter implements ExternalServiceAdapter { public String getAdapterName() { return AMETICDummyAdapter.adapterName; } AMETICDummyAdapter(); String getAdapterName(); @Override void _set(String attribute, Object value); @Override void _delete(String attribute); @Override Service... | @Test public void testGetAdapterName() { AMETICDummyAdapter adapter; try { adapter = createAdapter(); assert (adapter.getAdapterName().equals("AMETICDummyAdapter")); } catch (ServiceNotAvailableException e) { e.printStackTrace(); fail ("Service not available: "+e.getMessage()); } } |
AMETICDummyAdapter extends BasicAuthServiceAdapter implements ExternalServiceAdapter { @Override public ServiceResponse[] getRaw(String attribute) throws AttributeNotSupportedException, ServiceNotAvailableException, ServiceException { if (!this.isConnected()) { throw new ServiceNotAvailableException(); } AttributeMap a... | @Test public void testGetRaw() throws Exception { AMETICDummyAdapter adapter = createAdapter(); ServiceResponse[] attendees = adapter.getRaw("/event/@me/173/@all"); assertTrue (attendees[0].getResponse().length() > 0); ServiceResponse[] eventDetails = adapter.getRaw("/event/@me/173"); assertTrue (eventDetails[0].getRes... |
DMNDomainValidatorImpl implements DMNDomainValidator { @Override public String getDefinitionSetId() { return BindableAdapterUtils.getDefinitionSetId(DMNDefinitionSet.class); } @Inject DMNDomainValidatorImpl(final DMNMarshallerStandalone dmnMarshaller,
final DMNDiagramUtils dmnDiagramU... | @Test public void testGetDefinitionSetId() { assertThat(domainValidator.getDefinitionSetId()).isEqualTo(DMNDefinitionSet.class.getName()); } |
RendererUtils { public static Group getCenteredCellText(final GridBodyCellRenderContext context, final GridCell<String> gridCell) { final GridRenderer gridRenderer = context.getRenderer(); final GridRendererTheme theme = gridRenderer.getTheme(); final Group g = GWT.create(Group.class); String value = gridCell.getValue(... | @Test public void testRenderCenteredEmptyTextWithPlaceHolder() throws Exception { final BaseGridCell<String> cell = new BaseGridCell<>(new BaseGridCellValue<>(null, PLACE_HOLDER)); RendererUtils.getCenteredCellText(cellContext, cell); assertCenteredRenderingPlaceholder(placeHolderText); }
@Test public void testRenderCe... |
RendererUtils { public static Group getExpressionCellText(final GridBodyCellRenderContext context, final GridCell<String> gridCell) { final GridRenderer gridRenderer = context.getRenderer(); final GridRendererTheme theme = gridRenderer.getTheme(); return getExpressionText(theme, gridCell.getValue().getValue()); } stat... | @Test public void testRenderExpressionCellText() throws Exception { final BaseGridCell<String> cell = new BaseGridCell<>(new BaseGridCellValue<>(VALUE)); RendererUtils.getExpressionCellText(cellContext, cell); assertExpressionRendering(); } |
RendererUtils { public static Group getExpressionHeaderText(final EditableHeaderMetaData headerMetaData, final GridHeaderColumnRenderContext context) { final GridRenderer gridRenderer = context.getRenderer(); final GridRendererTheme theme = gridRenderer.getTheme(); return getExpressionText(theme, headerMetaData.getTitl... | @Test public void testRenderExpressionHeaderText() throws Exception { when(headerMetaData.getTitle()).thenReturn(VALUE); RendererUtils.getExpressionHeaderText(headerMetaData, headerContext); assertExpressionRendering(); } |
RendererUtils { public static Group getValueAndDataTypeHeaderText(final ValueAndDataTypeHeaderMetaData headerMetaData, final GridHeaderColumnRenderContext context, final double blockWidth, final double blockHeight) { return getNameAndDataTypeText(context.getRenderer().getTheme(), headerMetaData.getTitle(), headerMetaDa... | @Test public void testRenderHeaderContentWithNameAndDataTypeHeaderMetaData() { final ValueAndDataTypeHeaderMetaData metaData = mock(ValueAndDataTypeHeaderMetaData.class); when(metaData.getTitle()).thenReturn(TITLE); when(metaData.getTypeRef()).thenReturn(TYPE_REF); RendererUtils.getValueAndDataTypeHeaderText(metaData, ... |
RendererUtils { public static Group getNameAndDataTypeCellText(final InformationItemCell.HasNameAndDataTypeCell hasNameAndDataTypeCell, final GridBodyCellRenderContext context) { if (!hasNameAndDataTypeCell.hasData()) { final BaseGridCellValue<String> cell = new BaseGridCellValue<>(null, hasNameAndDataTypeCell.getPlace... | @Test public void testRenderHeaderContentWithInformationItemCell() { final InformationItemCell.HasNameAndDataTypeCell informationItemCell = mock(InformationItemCell.HasNameAndDataTypeCell.class); final Name name = new Name(TITLE); when(informationItemCell.getName()).thenReturn(name); when(informationItemCell.getTypeRef... |
RendererUtils { public static Group getEditableHeaderText(final EditableHeaderMetaData headerMetaData, final GridHeaderColumnRenderContext context, final double blockWidth, final double blockHeight) { final Group headerGroup = GWT.create(Group.class); final GridRenderer renderer = context.getRenderer(); final GridRende... | @Test public void testRenderEditableHeaderText() { when(headerMetaData.getTitle()).thenReturn(VALUE); RendererUtils.getEditableHeaderText(headerMetaData, headerContext, WIDTH, HEIGHT); assertCenteredRendering(headerText1); } |
RendererUtils { public static Group getEditableHeaderPlaceHolderText(final EditableHeaderMetaData headerMetaData, final GridHeaderColumnRenderContext context, final double blockWidth, final double blockHeight) { final Group headerGroup = GWT.create(Group.class); headerMetaData.getPlaceHolder().ifPresent(placeHolder -> ... | @Test public void testRenderEditableHeaderPlaceHolderText() { when(headerMetaData.getPlaceHolder()).thenReturn(Optional.of(VALUE)); RendererUtils.getEditableHeaderPlaceHolderText(headerMetaData, headerContext, WIDTH, HEIGHT); assertCenteredRendering(placeHolderText); }
@Test public void testRenderEditableHeaderPlaceHol... |
DynamicReadOnlyUtils { public static boolean isOnlyVisualChangeAllowed(final GridWidget gridWidget) { if (gridWidget instanceof BaseGrid) { final BaseGrid baseGrid = (BaseGrid) gridWidget; return baseGrid.isOnlyVisualChangeAllowed(); } return false; } static boolean isOnlyVisualChangeAllowed(final GridWidget gridWidge... | @Test public void testGridWidget() { assertThat(DynamicReadOnlyUtils.isOnlyVisualChangeAllowed(mock(GridWidget.class))).isFalse(); }
@Test public void testBaseGrid() { when(gridWidget.isOnlyVisualChangeAllowed()).thenReturn(false); assertThat(DynamicReadOnlyUtils.isOnlyVisualChangeAllowed(gridWidget)).isFalse(); }
@Tes... |
DMNParseServiceImpl implements DMNParseService { @Override public List<String> parseFEELList(final String source) { return parse(source) .map(this::getTextElements) .orElseGet(ArrayList::new); } @Override List<String> parseFEELList(final String source); @Override RangeValue parseRangeValue(final String source); } | @Test public void testParseFEELListMultipleCommasInside() { final List<String> actualList = service.parseFEELList("\"Sao Paulo, SP, South America\",\"New York, NY, North America\""); final List<String> expectedList = asList("\"Sao Paulo, SP, South America\"", "\"New York, NY, North America\""); assertEquals(expectedLis... |
SelectionUtils { public static boolean isMultiSelect(final GridData uiModel) { return uiModel.getSelectedCells().size() > 1; } static boolean isMultiSelect(final GridData uiModel); static boolean isMultiRow(final GridData uiModel); static boolean isMultiColumn(final GridData uiModel); static boolean isMultiHeaderColum... | @Test public void testIsMultiSelectZeroSelections() { assertThat(SelectionUtils.isMultiSelect(uiModel)).isFalse(); }
@Test public void testIsMultiSelectSingleSelection() { uiModel.selectCell(0, 0); assertThat(SelectionUtils.isMultiSelect(uiModel)).isFalse(); }
@Test public void testIsMultiSelectMultipleSelections() { u... |
SelectionUtils { public static boolean isMultiRow(final GridData uiModel) { return uiModel.getSelectedCells() .stream() .map(GridData.SelectedCell::getRowIndex) .distinct() .collect(Collectors.toList()) .size() > 1; } static boolean isMultiSelect(final GridData uiModel); static boolean isMultiRow(final GridData uiMode... | @Test public void testIsMultiRowZeroSelections() { assertThat(SelectionUtils.isMultiRow(uiModel)).isFalse(); }
@Test public void testIsMultiRowSingleSelection() { uiModel.selectCell(0, 0); assertThat(SelectionUtils.isMultiRow(uiModel)).isFalse(); }
@Test public void testIsMultiRowMultipleSelections() { uiModel.selectCe... |
SelectionUtils { public static boolean isMultiColumn(final GridData uiModel) { return isMultiColumn(uiModel.getSelectedCells()); } static boolean isMultiSelect(final GridData uiModel); static boolean isMultiRow(final GridData uiModel); static boolean isMultiColumn(final GridData uiModel); static boolean isMultiHeaderC... | @Test public void testIsMultiColumnZeroSelections() { assertThat(SelectionUtils.isMultiColumn(uiModel)).isFalse(); }
@Test public void testIsMultiColumnSingleSelection() { uiModel.selectCell(0, 0); assertThat(SelectionUtils.isMultiColumn(uiModel)).isFalse(); }
@Test public void testIsMultiColumnMultipleSelections() { u... |
DMNMarshallerStandalone implements DiagramMarshaller<Graph, Metadata, Diagram<Graph, Metadata>> { @Override @SuppressWarnings("unchecked") public Graph unmarshall(final Metadata metadata, final InputStream input) throws IOException { final Map<String, HasComponentWidths> hasComponentWidthsMap = new HashMap<>(); final B... | @Test public void test_function_java_WB_model() throws IOException { final DMNMarshallerStandalone m = getDMNMarshaller(); @SuppressWarnings("unchecked") final Graph<?, Node<?, ?>> g = m.unmarshall(createMetadata(), this.getClass().getResourceAsStream("/DROOLS-2372.dmn")); final Stream<Node<?, ?>> stream = StreamSuppor... |
SelectionUtils { public static boolean isMultiHeaderColumn(final GridData uiModel) { return isMultiColumn(uiModel.getSelectedHeaderCells()); } static boolean isMultiSelect(final GridData uiModel); static boolean isMultiRow(final GridData uiModel); static boolean isMultiColumn(final GridData uiModel); static boolean is... | @Test public void testIsMultiHeaderColumnZeroSelections() { assertThat(SelectionUtils.isMultiHeaderColumn(uiModel)).isFalse(); }
@Test public void testIsMultiHeaderColumnSingleSelection() { uiModel.selectHeaderCell(0, 0); assertThat(SelectionUtils.isMultiHeaderColumn(uiModel)).isFalse(); }
@Test public void testIsMulti... |
NameUtils { public static String normaliseName(final String name) { if (Objects.isNull(name)) { return ""; } String value = name; if (StringUtils.nonEmpty(value)) { value = value.trim(); value = value.replaceAll(NORMALIZE_TO_SINGLE_WHITE_SPACE, WHITESPACE_STRING); } return value; } private NameUtils(); static String n... | @Test public void testNull() { assertThat(NameUtils.normaliseName(null)).isEmpty(); }
@Test public void testEmpty() { assertThat(NameUtils.normaliseName("")).isEmpty(); }
@Test public void testLeadingWhitespace() { assertThat(NameUtils.normaliseName(" hello")).isEqualTo("hello"); }
@Test public void testTrailingWhitesp... |
TypeRefUtils { public static <E extends Expression> HasTypeRef getTypeRefOfExpression(final E expression, final HasExpression hasExpression) { HasTypeRef hasTypeRef = expression; final DMNModelInstrumentedBase base = hasExpression.asDMNModelInstrumentedBase(); if (base instanceof HasVariable) { final HasVariable hasVar... | @Test public void testGetTypeRefOfExpression() { when(hasExpression.asDMNModelInstrumentedBase()).thenReturn(mock(DMNModelInstrumentedBase.class)); when(expression.getTypeRef()).thenReturn(TYPE_REF); assertThat(TypeRefUtils.getTypeRefOfExpression(expression, hasExpression).getTypeRef()).isEqualTo(TYPE_REF); }
@Test pub... |
DMNMarshallerStandalone implements DiagramMarshaller<Graph, Metadata, Diagram<Graph, Metadata>> { List<org.kie.dmn.model.api.DRGElement> getImportedDrgElementsByShape(final List<DMNShape> dmnShapes, final Map<Import, org.kie.dmn.model.api.Definitions> importDefinitions) { final List<org.kie.dmn.model.api.DRGElement> im... | @Test public void testGetImportedDrgElementsByShape() { final DMNMarshallerStandalone marshaller = spy(getDMNMarshaller()); final List<org.kie.dmn.model.api.DRGElement> importedDRGElements = mock(List.class); final Map<Import, org.kie.dmn.model.api.Definitions> importDefinitions = mock(Map.class); final org.kie.dmn.mod... |
ExpressionEditorControlImpl extends AbstractCanvasControl<AbstractCanvas> implements ExpressionEditorControl { @Override public void bind(final DMNSession session) { final ExpressionEditorView.Presenter editor = makeExpressionEditor(view, decisionNavigator, dmnGraphUtils, dmnDiagramsSession); editor.bind(session); this... | @Test public void testBind() { control.bind(session); assertNotNull(control.getExpressionEditor()); verify(editor).bind(session); verify(canvasHandler).addDomainObjectListener(any(CanvasDomainObjectListener.class)); }
@Test public void testBindDomainObjectListenerWithNodeMatch() { final Definition definition = mock(Def... |
ExpressionEditorControlImpl extends AbstractCanvasControl<AbstractCanvas> implements ExpressionEditorControl { @Override protected void doInit() { } @Inject ExpressionEditorControlImpl(final ExpressionEditorView view,
final DecisionNavigatorPresenter decisionNavigator,
... | @Test public void testDoInit() { assertNull(control.getExpressionEditor()); control.doInit(); assertNull(control.getExpressionEditor()); } |
ExpressionEditorControlImpl extends AbstractCanvasControl<AbstractCanvas> implements ExpressionEditorControl { @Override protected void doDestroy() { view = null; decisionNavigator = null; session.ifPresent(s -> s.getCanvasHandler().removeDomainObjectListener(refreshEditorDomainObjectListener)); session = Optional.empt... | @Test public void testDoDestroy() { control.bind(session); verify(canvasHandler).addDomainObjectListener(domainObjectListenerCaptor.capture()); control.doDestroy(); assertNull(control.getExpressionEditor()); final CanvasDomainObjectListener domainObjectListener = domainObjectListenerCaptor.getValue(); verify(canvasHand... |
ExpressionEditorControlImpl extends AbstractCanvasControl<AbstractCanvas> implements ExpressionEditorControl { @SuppressWarnings("unused") public void onCanvasFocusedSelectionEvent(final @Observes CanvasSelectionEvent event) { session.ifPresent(s -> { if (Objects.equals(s.getCanvasHandler(), event.getCanvasHandler())) ... | @Test public void testOnCanvasFocusedSelectionEventWhenNotBound() { control.onCanvasFocusedSelectionEvent(event); verifyNoMoreInteractions(editor); } |
ExpressionEditorControlImpl extends AbstractCanvasControl<AbstractCanvas> implements ExpressionEditorControl { public void onCanvasElementUpdated(final @Observes CanvasElementUpdatedEvent event) { expressionEditor.ifPresent(editor -> editor.handleCanvasElementUpdated(event)); } @Inject ExpressionEditorControlImpl(fina... | @Test public void testOnCanvasElementUpdated() { control.bind(session); final CanvasElementUpdatedEvent event = new CanvasElementUpdatedEvent(canvasHandler, node); control.onCanvasElementUpdated(event); verify(editor).handleCanvasElementUpdated(event); } |
ExpressionContainerUIModelMapper extends BaseUIModelMapper<Expression> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { final String uuid = nodeUUID.get(); final GridData uiModel = this.uiModel.get(); final Optional<Expression> expression = dmnModel.get(); final Optional<HasName> hasNam... | @Test public void testFromDMNModelUndefinedExpressionType() { setup(false); expression = null; mapper.fromDMNModel(0, 0); assertFromDMNModelUndefinedExpressionType(false); }
@Test public void testFromDMNModelWhenOnlyVisualChangeAllowed() { setup(true); expression = null; mapper.fromDMNModel(0, 0); assertFromDMNModelUnd... |
DMNMarshallerStandalone implements DiagramMarshaller<Graph, Metadata, Diagram<Graph, Metadata>> { String getDmnElementRef(final DMNShape dmnShape) { return Optional .ofNullable(dmnShape.getDmnElementRef()) .map(QName::getLocalPart) .orElse(""); } protected DMNMarshallerStandalone(); @Inject DMNMarshallerStandalone(fi... | @Test public void testGetDmnElementRef() { final DMNMarshallerStandalone marshaller = spy(getDMNMarshaller()); final String expected = "localPart"; final DMNShape shape = mock(DMNShape.class); final javax.xml.namespace.QName ref = mock(javax.xml.namespace.QName.class); when(ref.getLocalPart()).thenReturn(expected); whe... |
ExpressionContainerUIModelMapper extends BaseUIModelMapper<Expression> { @Override public void toDMNModel(final int rowIndex, final int columnIndex, final Supplier<Optional<GridCellValue<?>>> cell) { throw new UnsupportedOperationException("ExpressionContainerUIModelMapper does not support updating DMN models."); } Exp... | @Test(expected = UnsupportedOperationException.class) public void testToDMNModelIsUnsupported() { setup(false); mapper.toDMNModel(0, 0, () -> null); } |
ExpressionEditorViewImpl implements ExpressionEditorView { @Override public void bind(final DMNSession session) { this.gridPanel = session.getGridPanel(); this.gridLayer = session.getGridLayer(); this.cellEditorControls = session.getCellEditorControls(); this.mousePanMediator = session.getMousePanMediator(); setupGridP... | @Test public void testBind() { verify(view).setupGridPanel(); verify(view).setupGridWidget(); verify(view).setupGridWidgetPanControl(); } |
ExpressionEditorViewImpl implements ExpressionEditorView { protected void setupGridPanel() { final Transform transform = new Transform().scale(VP_SCALE); gridPanel.getElement().setId("dmn_container_" + com.google.gwt.dom.client.Document.get().createUniqueId()); gridPanel.getViewport().setTransform(transform); final Bas... | @Test public void testSetupGridPanel() { verify(viewport).setTransform(transformArgumentCaptor.capture()); final Transform transform = transformArgumentCaptor.getValue(); assertEquals(ExpressionEditorViewImpl.VP_SCALE, transform.getScaleX(), 0.0); assertEquals(ExpressionEditorViewImpl.VP_SCALE, transform.getScaleY(), 0... |
ExpressionEditorViewImpl implements ExpressionEditorView { protected void setupGridWidget() { expressionContainerGrid = new ExpressionContainerGrid(gridLayer, cellEditorControls, translationService, listSelector, sessionManager, sessionCommandManager, canvasCommandFactory, expressionEditorDefinitionsSupplier, getExpres... | @Test public void testSetupGridWidget() { verify(gridLayer).removeAll(); verify(gridLayer).add(expressionContainerArgumentCaptor.capture()); final GridWidget expressionContainer = expressionContainerArgumentCaptor.getValue(); verify(gridLayer).select(eq(expressionContainer)); verify(gridLayer).enterPinnedMode(eq(expres... |
ExpressionEditorViewImpl implements ExpressionEditorView { protected void setupGridWidgetPanControl() { final TransformMediator defaultTransformMediator = new BoundaryTransformMediator(expressionContainerGrid); mousePanMediator.setTransformMediator(defaultTransformMediator); mousePanMediator.setBatchDraw(true); gridLay... | @Test public void testSetupGridWidgetPanControl() { verify(mousePanMediator).setTransformMediator(transformMediatorArgumentCaptor.capture()); final TransformMediator transformMediator = transformMediatorArgumentCaptor.getValue(); verify(mousePanMediator).setBatchDraw(true); verify(gridLayer).setDefaultTransformMediator... |
ExpressionEditorViewImpl implements ExpressionEditorView { @Override public void onResize() { gridPanelContainer.onResize(); } ExpressionEditorViewImpl(); @Inject ExpressionEditorViewImpl(final Anchor returnToLink,
final Span expressionName,
final... | @Test public void testOnResize() { view.onResize(); verify(gridPanelContainer).onResize(); verify(gridPanel).onResize(); } |
ExpressionEditorViewImpl implements ExpressionEditorView { @Override public void setReturnToLinkText(final String text) { returnToLink.setTextContent(translationService.format(DMNEditorConstants.ExpressionEditor_ReturnToLink, text)); } ExpressionEditorViewImpl(); @Inject ExpressionEditorViewImpl(final Anchor returnToL... | @Test public void testSetReturnToLinkText() { final String RETURN_LINK = "return-link"; view.setReturnToLinkText(RETURN_LINK); verify(returnToLink).setTextContent(eq(RETURN_LINK)); } |
ExpressionEditorViewImpl implements ExpressionEditorView { @Override public void setExpression(final String nodeUUID, final HasExpression hasExpression, final Optional<HasName> hasName, final boolean isOnlyVisualChangeAllowed) { expressionContainerGrid.setExpression(nodeUUID, hasExpression, hasName, isOnlyVisualChangeA... | @Test public void testSetExpression() { final Optional<HasName> hasName = Optional.empty(); view.setExpression(NODE_UUID, hasExpression, hasName, false); verify(gridLayer).add(expressionContainerArgumentCaptor.capture()); final ExpressionContainerGrid expressionContainer = (ExpressionContainerGrid) expressionContainerA... |
DMNMarshallerStandalone implements DiagramMarshaller<Graph, Metadata, Diagram<Graph, Metadata>> { List<DMNShape> getUniqueDMNShapes(final org.kie.dmn.model.api.dmndi.DMNDiagram dmnDDDiagram) { return new ArrayList<>(dmnDDDiagram .getDMNDiagramElement() .stream() .filter(diagramElements -> diagramElements instanceof DMN... | @Test public void testGetUniqueDMNShapes() { final DMNMarshallerStandalone marshaller = spy(getDMNMarshaller()); final org.kie.dmn.model.api.dmndi.DMNDiagram diagram = mock(org.kie.dmn.model.api.dmndi.DMNDiagram.class); final List<DiagramElement> elements = new ArrayList<>(); final DMNShape unique1 = mock(DMNShape.clas... |
ExpressionEditorViewImpl implements ExpressionEditorView { @SuppressWarnings("unused") @EventHandler("returnToLink") void onClickReturnToLink(final ClickEvent event) { presenter.exit(); } ExpressionEditorViewImpl(); @Inject ExpressionEditorViewImpl(final Anchor returnToLink,
final S... | @Test public void testOnClickReturnToLink() { view.onClickReturnToLink(mock(ClickEvent.class)); verify(presenter).exit(); } |
ExpressionEditorViewImpl implements ExpressionEditorView { @Override public void refresh() { gridLayer.batch(); } ExpressionEditorViewImpl(); @Inject ExpressionEditorViewImpl(final Anchor returnToLink,
final Span expressionName,
final Span express... | @Test public void testRefresh() { view.refresh(); verify(gridLayer).batch(); } |
ExpressionEditorViewImpl implements ExpressionEditorView { @Override public void setFocus() { gridPanel.setFocus(true); } ExpressionEditorViewImpl(); @Inject ExpressionEditorViewImpl(final Anchor returnToLink,
final Span expressionName,
final Span... | @Test public void testSetFocus() { view.setFocus(); verify(gridPanel).setFocus(true); } |
ExpressionContainerGrid extends BaseGrid<Expression> { @Override public boolean onDragHandle(final INodeXYEvent event) { return false; } ExpressionContainerGrid(final DMNGridLayer gridLayer,
final CellEditorControlsView.Presenter cellEditorControls,
... | @Test public void testGridDraggingIsDisabled() { assertThat(grid.onDragHandle(mock(INodeXYEvent.class))).isFalse(); } |
ExpressionContainerGrid extends BaseGrid<Expression> { @Override public void deselect() { getModel().clearSelections(); super.deselect(); } ExpressionContainerGrid(final DMNGridLayer gridLayer,
final CellEditorControlsView.Presenter cellEditorControls,
... | @Test public void testDeselect() { grid.getModel().selectCell(0, 0); assertFalse(grid.getModel().getSelectedCells().isEmpty()); grid.deselect(); assertTrue(grid.getModel().getSelectedCells().isEmpty()); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.