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).

sclass Test_PairCollector {
  PairCollector<S, Int> collector;
  S result;
  
  void makeCollector {
    collector = new PairCollector;
    swap method collector.complete(a, b) {
      result = "Got " + a + " + " + b;
    }
    result = null;
  }
  
  run {
    makeCollector();
    collector.setA("Hello");
    assertNull(result);
    collector.setB(123);
    assertEqualsVerbose(result, "Got Hello + 123");

    makeCollector();
    collector.setterForB().get(456);
    assertNull(result);
    collector.setterForA().get("Yo");
    assertEqualsVerbose(result, "Got Yo + 456");
  }
}

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: 148 / 213
Version history: 4 change(s)
Referenced in: [show references]