Created
November 21, 2017 13:29
-
-
Save shelajev/d128bb1ed7c09ce1ad610d4f9d082b85 to your computer and use it in GitHub Desktop.
Rubah test classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.shelajev.updates; | |
| import rubah.Rubah; | |
| public class Component { | |
| private static DataHolder data = new DataHolder(0); | |
| public String wrangle(int i, String s) { | |
| Rubah.update("wrangle"); | |
| // return "v0: " + i + ", " + data + ", " + data.counter++; | |
| return "v1: " + i + ", " + data + ", " + data.counter++ + ", " + data.name.toString(); | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.shelajev.updates; | |
| import rubah.RubahThread; | |
| public class Main { | |
| public static void main(String[] args) { | |
| RubahThread rubahThread = new RubahThread() { | |
| @Override protected void rubahRun() { | |
| Component c = new Component(); | |
| for(int i = 0; i < Long.MAX_VALUE; i++) { | |
| System.out.println(c.wrangle(i, Integer.toHexString(i))); | |
| try { | |
| Thread.sleep(1000); | |
| } | |
| catch (InterruptedException e) { | |
| } | |
| } | |
| } | |
| }; | |
| rubahThread.start(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.shelajev.updates; | |
| public class DataHolder { | |
| public int counter; | |
| public DataHolder(int counterValue) { | |
| this.counter = counterValue; | |
| } | |
| @Override public String toString() { | |
| return "DataHolder {" + | |
| "counter=" + counter + | |
| '}'; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.shelajev.updates; | |
| public class DataHolder { | |
| public static String DEFAULT_NAME = "DEFAULT_NAME"; | |
| public int counter; | |
| public String name; | |
| public DataHolder(int counterValue) { | |
| this.counter = counterValue; | |
| this.name = DEFAULT_NAME; | |
| } | |
| @Override public String toString() { | |
| return "DataHolder {" + | |
| "counter=" + counter + | |
| ", name=" + name + | |
| '}'; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment