Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1035563 // Test_PairCollector (OK)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9213L/51K).

1  
sclass Test_PairCollector {
2  
  PairCollector<S, Int> collector;
3  
  S result;
4  
  
5  
  void makeCollector {
6  
    collector = new PairCollector;
7  
    swap method collector.complete(a, b) {
8  
      result = "Got " + a + " + " + b;
9  
    }
10  
    result = null;
11  
  }
12  
  
13  
  run {
14  
    makeCollector();
15  
    collector.setA("Hello");
16  
    assertNull(result);
17  
    collector.setB(123);
18  
    assertEqualsVerbose(result, "Got Hello + 123");
19  
20  
    makeCollector();
21  
    collector.setterForB().get(456);
22  
    assertNull(result);
23  
    collector.setterForA().get("Yo");
24  
    assertEqualsVerbose(result, "Got Yo + 456");
25  
  }
26  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035563
Snippet name: Test_PairCollector (OK)
Eternal ID of this version: #1035563/5
Text MD5: 0284b5f4d4fce04f9afd7f530ef485db
Transpilation MD5: 2bf581a74825712972ec63bb0e427d3d
Author: stefan
Category: javax / parallelism
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-06-17 00:31:16
Source code size: 609 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 149 / 214
Version history: 4 change(s)
Referenced in: [show references]